with postgresql, it occur in comment module:314

# warning: pg_query(): Query failed: ERROR: for SELECT DISTINCT, ORDER BY expressions must appear in select list in /var/www/drupal-6.15/includes/database.pgsql.inc on line 139.

a patch is attached.

A description about PostgreSQL and select list, please see similar bug report http://drupal.org/node/742006#comment-2718292

Comments

dddave’s picture

Marked #742424: Error when upgrade to 6.16 from 6.15 as duplicate.

a patch is attached.

No, it isn't. ;)

wa2nlinux’s picture

Where is the patch ?

roderik’s picture

Status: Active » Closed (duplicate)

Again marked this one duplicate, of #742006: ERROR: for SELECT DISTINCT, ORDER BY expressions must appear in select list
For the 'patch', follow the link in the original message.

another_sam’s picture

Version: 6.15 » 6.19

(Duplicated for actually which bug is this?)

I'm using 6.19 and the bug still exists. I fixed modifying database.pgsql.inc as follows:

BEFORE:

$last_result = pg_query($active_db, $query);

AFTER:

$bad = "SELECT DISTINCT t.* FROM dp_term_node r";
$good = "SELECT DISTINCT t.*, v.weight FROM dp_term_node r";

if (strpos($query, $bad) === 0) {
  $query = $good . 
        substr($query, strlen($bad));
}

$last_result = pg_query($active_db, $query);

But this fix is a piece of shit since it is a replacement on runtime. The replacement should be simply manually hardcoded where the SELECT clause is composed, but I don't know where is it; someone who knows or who finds, please do it.

Thank you.

dddave’s picture