I'm working on a Ruby app which uses the mysql functions XOR (^) and BIT_COUNT(). However I now need to run the app on Heroku, which runs PyGreSQL.
I can't find any documentation for the bits of PyGreSQL that can help me.
So can anyone translate this mysql query so that it would work when executed on a pygresql database?
SELECT * FROM "photos" WHERE BIT_COUNT(phash ^ 2061756291569501157) <= 15
pygresql gives me the error
ERROR: operator does not exist: text ^ bigint
thanks.
#
is bitwise XOR. (See postgresql.org/docs/7.4/static/functions-math.html) I'm not sure there's an exact parallel forbit_count()
. – SubmediantPostgreSQL
. PyGreSQL is just the Python module for Postgres. Unless there's something specific to that module, you'll see more help from the Postgres users. The same users don't refer to it asDBD::Pg
for Perl, unless the problem has to do with that module specifically, and not the underlying db/query. – Scrag