[drupal-devel] [bug] Forum module's use of if in Postgresql

patrickslee drupal-devel at drupal.org
Tue May 24 22:07:53 UTC 2005

Issue status update for http://drupal.org/node/23499

 Project:      Drupal
 Version:      4.6.0
 Component:    forum.module
 Category:     bug reports
 Priority:     normal
-Assigned to:  Anonymous
+Assigned to:  patrickslee
 Reported by:  cchamilt
 Updated by:   patrickslee
-Status:       active
+Status:       patch
 Attachment:   http://drupal.org/files/issues/forum.module_3.patch (2.69 KB)

I have also encountered this bug and made a possible patch by replacing
IF statements to CASE.
A patch file is attached.


Previous comments:

May 24, 2005 - 16:32 : cchamilt

Postgresql function "if" is defined to return a boolean value, yet forum
requests an integer - last_comment_uid.

user error:
query: SELECT n.nid, l.last_comment_timestamp, IF(l.last_comment_uid,
cu.name, l.last_comment_name) as last_comment_name, l.last_comment_uid
FROM node n, node_comment_statistics l /*! USE INDEX
(node_comment_timestamp) */, users cu, term_node r WHERE  n.nid = r.nid
AND r.tid = 1 AND n.status = 1 AND n.type = 'forum' AND
l.last_comment_uid = cu.uid AND n.nid = l.nid ORDER BY
l.last_comment_timestamp DESC LIMIT 1 OFFSET 0 in
/var/www/hosts/www.ambigc.com/htdocs/includes/database.pgsql.inc on
line 62.

warning: pg_query() [function.pg-query]: Query failed: ERROR:  function
if(integer, character varying, character varying) does not exist
HINT:  No function matches the given name and argument types. You may
need to add explicit type casts. in
/var/www/hosts/www.ambigc.com/htdocs/includes/database.pgsql.inc on
line 45.

More information about the drupal-devel mailing list