New vanilla installation. Postgres database.
Drupal 5.2
taxonomy_access 5.x-2.x-dev

When enabling the module:

* warning: pg_query() [function.pg-query]: Query failed: ERROR: syntax error at or near "ta" at character 8 in /dat/webapps/drupal-5.2/includes/database.pgsql.inc on line 125.
* user warning: query: DELETE ta FROM term_access ta LEFT JOIN term_data td ON ta.tid = td.tid WHERE ta.tid <> 0 AND ISNULL(td.tid) in /dat/webapps/drupal-5.2/includes/database.pgsql.inc on line 144.
* warning: pg_query() [function.pg-query]: Query failed: ERROR: syntax error at or near "tad" at character 8 in /dat/webapps/drupal-5.2/includes/database.pgsql.inc on line 125.
* user warning: query: DELETE tad FROM term_access_defaults tad LEFT JOIN vocabulary v ON tad.vid = v.vid WHERE tad.vid <> 0 AND ISNULL(v.vid) in /dat/webapps/drupal-5.2/includes/database.pgsql.inc on line 144.
* warning: pg_query() [function.pg-query]: Query failed: ERROR: syntax error at or near "ta" at character 8 in /dat/webapps/drupal-5.2/includes/database.pgsql.inc on line 125.
* user warning: query: DELETE ta FROM term_access ta LEFT JOIN role r ON ta.rid = r.rid WHERE ISNULL(r.rid) in /dat/webapps/drupal-5.2/includes/database.pgsql.inc on line 144.
* warning: pg_query() [function.pg-query]: Query failed: ERROR: syntax error at or near "tad" at character 8 in /dat/webapps/drupal-5.2/includes/database.pgsql.inc on line 125.
* user warning: query: DELETE tad FROM term_access_defaults tad LEFT JOIN role r ON tad.rid = r.rid WHERE ISNULL(r.rid) in /dat/webapps/drupal-5.2/includes/database.pgsql.inc on line 144.

After that everything seems to work. I set the vocabulary with term 'private' in it. Then I edited anonymous and authenticated users and took away all the rights. No errors, no warnings.

When I log out from admin account, I get the warning on EVERY page:

* warning: pg_query() [function.pg-query]: Query failed: ERROR: argument of HAVING must be type boolean, not type smallint in /dat/webapps/drupal-5.2/includes/database.pgsql.inc on line 125.
* user warning: query: SELECT t.tid AS tid, t.vid AS vid FROM term_data t INNER JOIN term_access_defaults tdg ON tdg.vid=0 LEFT JOIN term_access_defaults td ON td.vid=t.vid AND td.rid=tdg.rid LEFT JOIN term_access ta ON ta.tid=t.tid AND ta.rid=tdg.rid WHERE tdg.rid IN (1) GROUP BY t.tid HAVING BIT_OR(COALESCE(ta.grant_list, td.grant_list, tdg.grant_list)) in /dat/webapps/drupal-5.2/includes/database.pgsql.inc on line 144.

Comments

Ddaffyd’s picture

More errors on Forums:

* warning: pg_query() [function.pg-query]: Query failed: ERROR: syntax error at or near "ON" at character 31 in /dat/webapps/drupal-5.2/includes/database.pgsql.inc on line 125.
* user warning: query: SELECT r.tid, COUNT( DISTINCT ON (n.nid) n.nid) AS topic_count, SUM(l.comment_count) AS comment_count FROM node n INNER JOIN node_comment_statistics l ON n.nid = l.nid INNER JOIN term_node r ON n.nid = r.nid INNER JOIN node_access na ON na.nid = n.nid WHERE (na.grant_view >= 1 AND ((na.gid = 0 AND na.realm = 'all') OR (na.gid = 1 AND na.realm = 'term_access'))) AND ( n.status = 1 AND n.type = 'forum' ) GROUP BY r.tid in /dat/webapps/drupal-5.2/includes/database.pgsql.inc on line 144.
* warning: pg_query() [function.pg-query]: Query failed: ERROR: syntax error at or near "ON" at character 24 in /dat/webapps/drupal-5.2/includes/database.pgsql.inc on line 125.
* user warning: query: SELECT COUNT( DISTINCT ON (n.nid) n.nid) FROM node n INNER JOIN term_node tn ON n.nid = tn.nid AND tn.tid = 2 LEFT JOIN history h ON n.nid = h.nid AND h.uid = 0 INNER JOIN node_access na ON na.nid = n.nid WHERE (na.grant_view >= 1 AND ((na.gid = 0 AND na.realm = 'all') OR (na.gid = 1 AND na.realm = 'term_access'))) AND ( n.status = 1 AND n.type = 'forum' AND n.created > 1186223209 AND h.nid IS NULL) in /dat/webapps/drupal-5.2/includes/database.pgsql.inc on line 144.

My PostgreSQL version: 8.0.13

Ddaffyd’s picture

The forums problem was fixed by: http://drupal.org/files/issues/20070330-drupal-database.patch

The original problem I fixed temporary by comparing the result of BIT_OR: BIT_OR(...) > 0, and adding the t.vid field to GROUP BY clause.

I did not have time to understand the logic of the module, so the BIT_OR(...) > 0 part can be very wrong.

...
GROUP BY t.tid, t.vid HAVING BIT_OR(COALESCE(ta.grant_$op, td.grant_$op, tdg.grant_$op)) > 0");
...

klance’s picture

...followed by a long, eerie silence. :-) Sure, whatever, I'll do the same.

klance’s picture

BTW thanks very much for the code, Ddaffyd. My error log is clean again (yay).

xjm’s picture

Status: Active » Closed (fixed)

This appears to be fixed now.