PostgreSQL problem in plugin "Last Google search"

Found a bug? Tell us!!
Post Reply
ads
Regular
Posts: 93
Joined: Sun Oct 29, 2006 11:39 am

PostgreSQL problem in plugin "Last Google search"

Post 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.
blog.brockha.us
Regular
Posts: 695
Joined: Tue Jul 03, 2007 3:34 am
Location: Berlin, Germany
Contact:

Re: PostgreSQL problem in plugin "Last Google search"

Post 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!
- Grischa Brockhaus - http://blog.brockha.us
- Want to make me happy? http://wishes.brockha.us/
Post Reply