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

ChrisKennedy’s picture

Status: Active » Fixed

Thanks for the bug report. Should be fixed by http://drupal.org/cvs?commit=76721

anders.fajerson’s picture

Shouldn't it be a db_rewrite_sql() for the poll block?

ChrisKennedy’s picture

I 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.

anders.fajerson’s picture

ChrisKennedy’s picture

Well if it's for security purposes let's make a separate issue.

Anonymous’s picture

Status: Fixed » Closed (fixed)