When I use a PostgreSQL as backend it can't interprating some DISTINCTed SQL command:

# warning: pg_query() [function.pg-query]: Query failed: ERROR: for SELECT DISTINCT, ORDER BY expressions must appear in select list in C:\www\drupal-5.16\includes\database.pgsql.inc on line 127.
# user warning: query: SELECT DISTINCT(n.nid) FROM (SELECT DISTINCT ON (nid) * FROM node) n INNER JOIN node_revisions nr ON nr.vid = n.vid INNER JOIN weblinks bw ON bw.vid = nr.vid LEFT JOIN term_node tn ON tn.nid=n.nid WHERE n.status = 1 AND tn.tid IN (23) ORDER BY bw.weight ASC, n.title ASC in C:\www\drupal-5.16\includes\database.pgsql.inc on line 146.

The issue is on line 1858 in weblinks.module:

$query = 'SELECT DISTINCT(n.nid) FROM {node} n ';

which was

$query = 'SELECT n.nid FROM {node} n ';

in the previous version, and worked correctly.

CommentFileSizeAuthor
#1 weblinks_50.patch1.81 KBnancydru

Comments

nancydru’s picture

Status: Active » Needs review
StatusFileSize
new1.81 KB

It would not have worked if you had revisions enabled - you would have ended up with duplicated links.

Please try the attached patch

nancydru’s picture

Neither of this module's developers have Postgres - we need you to test the changes and let us know if it works.

nancydru’s picture

This was committed to 6.x-2.x-dev.

nancydru’s picture

Status: Needs review » Fixed
nancydru’s picture

Committed to 5.x branch.

nancydru’s picture

Status: Fixed » Closed (fixed)