Page 1 of 1

PostgreSQL problem in plugin "Last Google search"

Posted: Mon Jun 29, 2009 2:28 am
by ads
The plugin "Last Google search" has a problem with PostgreSQL as database backend.
The functions query_references() and query_visitors() build a query like:

Code: Select all

where (0 or (host like '%.google.%' and path like '/search'))
First: i don't know why there is the "0 or" at all, because this part could easily avoided by using an array and join() the query parts with " or ". Anyway, PostgreSQL is picky about the "0":
ERROR: argument of OR must be type boolean, not type integer
Because the "0" is given in plain format, PostgreSQL interprets the "0" as an integer, but the WHERE expects a boolean result. This problem can be avoided if PostgreSQL is allowed to assume the datatype:

Code: Select all

where ('0' or (host like '%.google.%' and path like '/search'))
By adding single quotes around the "0" PostgreSQL will automatically cast the value to boolean.

Voila.

Re: PostgreSQL problem in plugin "Last Google search"

Posted: Mon Jun 29, 2009 9:35 pm
by blog.brockha.us
Thanks for the input, this will be fixed in Spartacus soon, too.

Later: Fixed it using a join as you proposed. Stupid me not doing this before. :)
The fix was committed as V.1.15. Thanks again!