I have transferred bases with mysql on postgresql and now, at calling on a forum there is such error
_________________________________

warning: pg_query() [function.pg-query]: Query failed: ERROR: function if(boolean, character varying, character varying) does not exist at character 98 HINT: No function matches the given name and argument types. You might need to add explicit type casts. in /home...public_html/includes/database.pgsql.inc on line 139.
user warning: query: SELECT n.nid, n.title, n.type, ncs.last_comment_timestamp, IF (ncs.last_comment_uid != 0, u2.name, ncs.last_comment_name) AS last_comment_name, ncs.last_comment_uid FROM drupal_node n INNER JOIN drupal_users u1 ON n.uid = u1.uid INNER JOIN drupal_term_node tn ON n.vid = tn.vid INNER JOIN drupal_node_comment_statistics ncs ON n.nid = ncs.nid INNER JOIN drupal_users u2 ON ncs.last_comment_uid=u2.uid WHERE n.status = 1 AND tn.tid = 12 ORDER BY ncs.last_comment_timestamp DESC LIMIT 1 OFFSET 0 in /home...public_html/sites/all/modules/advanced_forum/advanced_forum.module on line 1027.
warning: pg_query() [function.pg-query]: Query failed: ERROR: function if(boolean, character varying, character varying) does not exist at character 98 HINT: No function matches the given name and argument types. You might need to add explicit type casts. in /home...public_html/includes/database.pgsql.inc on line 139.
user warning: ERROR: function if(boolean, character varying, character varying) does not exist at character 98 HINT: No function matches the given name and argument types. You might need to add explicit type casts. query: SELECT n.nid, n.title, n.type, ncs.last_comment_timestamp, IF (ncs.last_comment_uid != 0, u2.name, ncs.last_comment_name) AS last_comment_name, ncs.last_comment_uid FROM drupal_node n INNER JOIN drupal_users u1 ON n.uid = u1.uid INNER JOIN drupal_term_node tn ON n.vid = tn.vid INNER JOIN drupal_node_comment_statistics ncs ON n.nid = ncs.nid INNER JOIN drupal_users u2 ON ncs.last_comment_uid=u2.uid WHERE n.status = 1 AND tn.tid = 13 ORDER BY ncs.last_comment_timestamp DESC LIMIT 1 OFFSET 0 in /home...public_html/sites/all/modules/advanced_forum/advanced_forum.module on line 1027.
warning: pg_query() [function.pg-query]: Query failed: ERROR: function if(boolean, character varying, character varying) does not exist at character 98 HINT: No function matches the given name and argument types. You might need to add explicit type casts. in /home...public_html/includes/database.pgsql.inc on line 139.
user warning: ERROR: function if(boolean, character varying, character varying) does not exist at character 98 HINT: No function matches the given name and argument types. You might need to add explicit type casts. query: SELECT n.nid, n.title, n.type, ncs.last_comment_timestamp, IF (ncs.last_comment_uid != 0, u2.name, ncs.last_comment_name) AS last_comment_name, ncs.last_comment_uid FROM drupal_node n INNER JOIN drupal_users u1 ON n.uid = u1.uid INNER JOIN drupal_term_node tn ON n.vid = tn.vid INNER JOIN drupal_node_comment_statistics ncs ON n.nid = ncs.nid INNER JOIN drupal_users u2 ON ncs.last_comment_uid=u2.uid WHERE n.status = 1 AND tn.tid = 14 ORDER BY ncs.last_comment_timestamp DESC LIMIT 1 OFFSET 0 in /home...public_html/sites/all/modules/advanced_forum/advanced_forum.module on line 1027.
warning: pg_query() [function.pg-query]: Query failed: ERROR: function if(boolean, character varying, character varying) does not exist at character 98 HINT: No function matches the given name and argument types. You might need to add explicit type casts. in /home...public_html/includes/database.pgsql.inc on line 139.
user warning: ERROR: function if(boolean, character varying, character varying) does not exist at character 98 HINT: No function matches the given name and argument types. You might need to add explicit type casts. query: SELECT n.nid, n.title, n.type, ncs.last_comment_timestamp, IF (ncs.last_comment_uid != 0, u2.name, ncs.last_comment_name) AS last_comment_name, ncs.last_comment_uid FROM drupal_node n INNER JOIN drupal_users u1 ON n.uid = u1.uid INNER JOIN drupal_term_node tn ON n.vid = tn.vid INNER JOIN drupal_node_comment_statistics ncs ON n.nid = ncs.nid INNER JOIN drupal_users u2 ON ncs.last_comment_uid=u2.uid WHERE n.status = 1 AND tn.tid = 15 ORDER BY ncs.last_comment_timestamp DESC LIMIT 1 OFFSET 0 in /home...public_html/sites/all/modules/advanced_forum/advanced_forum.module on line 1027.
..............

Drupal 6.14 PostgreSQL 8.3.8

Comments

michelle’s picture

Priority: Critical » Normal
Status: Active » Postponed (maintainer needs more info)

I don't support postgres. If someone can provide a patch that will fix this without breaking mysql, I'll take it. Otherwise, there's nothing I can do.

Michelle

grub3’s picture

Status: Postponed (maintainer needs more info) » Active

Dear Michelle,

I wrote a guideline for writing compliant SQL code :
http://drupal.org/node/559302

You will also find a MYSQL/PostgreSQL section:
http://drupal.org/node/555514

I am reopening this issue to fix it.
I can only encourage you to read my guides.

Kind regards,
Jean-Michel

grub3’s picture

DuskMan, the queries work on my PostgreSQL database. This is not error. Your installation lacks PostgreSQL functions added by Drupal installation:

CREATE OR REPLACE FUNCTION "if"(boolean, text, text)
  RETURNS text AS
'SELECT CASE WHEN $1 THEN $2 ELSE $3 END;'
  LANGUAGE 'sql' VOLATILE
  COST 100;
CREATE OR REPLACE FUNCTION "if"(boolean, integer, integer)
  RETURNS integer AS
'SELECT CASE WHEN $1 THEN $2 ELSE $3 END;'
  LANGUAGE 'sql' VOLATILE
  COST 100;

There is something wrong with your installation.
Closing the bug.

grub3’s picture

Assigned: Unassigned » grub3
Status: Active » Closed (fixed)

Closed.

michelle’s picture

@jmpoure: Thanks but I don't have postgreSQL to test on and already have a full plate so am not looking to learn something new at this time. As I said, if someone wants to support it, I will accept patches as long as they don't break mysql.

Michelle