PostgreSQL problem in plugin "Last Google search"
Posted: Mon Jun 29, 2009 2:28 am
The plugin "Last Google search" has a problem with PostgreSQL as database backend.
The functions query_references() and query_visitors() build a query like:
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":
By adding single quotes around the "0" PostgreSQL will automatically cast the value to boolean.
Voila.
The functions query_references() and query_visitors() build a query like:
Code: Select all
where (0 or (host like '%.google.%' and path like '/search'))
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:ERROR: argument of OR must be type boolean, not type integer
Code: Select all
where ('0' or (host like '%.google.%' and path like '/search'))
Voila.