warning: pg_query(): Query failed: ERROR: argument of NOT must be type boolean, not type integer
CONTEXT: PL/pgSQL function "if" line 5 at if in /var/www/drupal/includes/database.pgsql.inc on line 104.

user error:
query: SELECT n.nid, f.tid, n.title, n.sticky, u.name, u.uid, n.created AS timestamp, n.comment AS comment_mode, l.last_comment_timestamp, IF(l.last_comment_uid, cu.name, l.last_comment_name) as last_comment_name, l.last_comment_uid, l.comment_count AS num_comments FROM node n INNER JOIN node_access na ON (na.nid = 0 OR na.nid = n.nid), node_comment_statistics l, users cu, term_node r, users u, forum f WHERE n.status = 1 AND l.last_comment_uid = cu.uid AND n.nid = l.nid AND n.nid = r.nid AND r.tid = '4' AND n.uid = u.uid AND n.nid = f.nid AND na.grant_view = 1 AND CONCAT(na.realm, na.gid) IN ('all0') ORDER BY n.sticky DESC, l.last_comment_timestamp DESC LIMIT 25 OFFSET 0 in /var/www/drupal/includes/database.pgsql.inc on line 121.

when accessing my first comment in the forum

Comments

Anonymous’s picture

CREATE OR REPLACE FUNCTION if(integer, text, text) RETURNS text
AS '
BEGIN
IF $1>0 THEN
RETURN $2;
END IF;
IF $1<=0 THEN
RETURN $3;
END IF;
END;
'
LANGUAGE plpgsql;

Uwe Hermann’s picture

Is this still a problem in HEAD or 4.6?

Zen’s picture

Title:Argument NOT must be type boolean» Argument NOT must be type boolean [Forum Module + pgSQL]

This is apparently fixed in 4.6+. Can any pgSQL users please confirm? And as this has been filed under 4.5.0, please confirm the status of this issue if you are using the 4.5.x tree..

Thanks
-K

Zen’s picture

Status:Active» Fixed

Changing status to fixed as it's been fixed in HEAD. Checked this with the pgSQL maintainer..

-K

Anonymous’s picture

Status:Fixed» Closed (fixed)