Ok, I've been wondering why I couldn't use my forum.

Bug reports started looking like

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, users cu, term_node r WHERE n.nid = r.nid AND r.tid = 64 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;

where Postgres complained the function if was unknown.

In fact, it it was unknown with the arguments (boolean,anyelement,anyelement).

However, when one creates the function

CREATE FUNCTION "if"(integer, anyelement, anyelement) RETURNS anyelement AS '
SELECT CASE 
   WHEN $1 = 1 
      THEN $2 
   ELSE $3 
END;
' LANGUAGE 'sql';

it actually works last_comment_uid is an integer, and not a boolean value.

The old definition can be left in place as it won't hurt, postgres uses the right function according to the arguments.

I suspect this is an issue in cvs as well, maybe somebody got to test it, I'm too lazy.

Comments

Cvbge’s picture

Status: Needs review » Closed (duplicate)

Hi, thanks for your report.

This bug was fixed in http://drupal.org/node/35061 issue.