With postgresql the advanced poll module gives this 2 warning message if I put the recent polls block to the drupal site:
* warning: pg_query(): Query failed: ERROR: syntax error at or near "nid" at character 19 in /usr/share/drupal5/includes/database.pgsql.inc on line 125.
* user warning: query: SELECT MAX(n.nid) nid FROM node n INNER JOIN advpoll p ON p.nid = n.nid WHERE n.status = 1 AND p.active=1 in /usr/share/drupal5/includes/database.pgsql.inc on line 144.
As I tracked down, in the advpoll.module the advpoll_mostrecent function has a query on line 66:
$result = db_query('SELECT MAX(n.nid) nid FROM {node} n INNER JOIN {advpoll} p ON p.nid = n.nid WHERE n.status = 1 AND p.active=1');
The warning message disappeared after I changed the line like this:
$result = db_query('SELECT MAX(n.nid) as nid FROM {node} n INNER JOIN {advpoll} p ON p.nid = n.nid WHERE n.status = 1 AND p.active=1');
Comments
Comment #1
ChrisKennedy commentedThanks for the bug report. Should be fixed by http://drupal.org/cvs?commit=76721
Comment #2
anders.fajerson commentedShouldn't it be a db_rewrite_sql() for the poll block?
Comment #3
ChrisKennedy commentedI don't know, what's the difference? I do see that poll.module uses db_rewrite_sql now that you mention it. The documentation for db_rewrite_sql doesn't really explain when it should be used.
Comment #4
anders.fajerson commentedI found this: http://drupal.org/node/93737
Comment #5
ChrisKennedy commentedWell if it's for security purposes let's make a separate issue.
Comment #6
(not verified) commented