Initially posted in the wrong place, posting here.
AFTER patching with the patch in post #69 of #128846: Rewritten PostgreSQL queries fail and post #93 of #153998: Access checks returning NULL is ugly. I get the following errors when Forum_access and ACL are enabled. No errors with only ACL. Postgres 8.3, Drupal 6.2
* warning: pg_query() [function.pg-query]: Query failed: ERROR: operator does not exist: character varying = integer LINE 1: ...a ON t.tid = fa.tid LEFT JOIN acl acl ON acl.name = t.tid AN... ^ HINT: No operator matches the given name and argument type(s). You might need to add explicit type casts. in /home/soanis/public_html/includes/database.pgsql.inc on line 138.
* user warning: query: SELECT t.* FROM term_node r INNER JOIN (SELECT DISTINCT ON (tid) * FROM term_data) t ON r.tid = t.tid INNER JOIN vocabulary v ON t.vid = v.vid LEFT JOIN forum_access fa ON t.tid = fa.tid LEFT JOIN acl acl ON acl.name = t.tid AND acl.module = 'forum_access' LEFT JOIN acl_user aclu ON aclu.acl_id = acl.acl_id AND aclu.uid = 0 WHERE ((fa.grant_view >= 1 AND fa.rid IN (1)) OR fa.tid IS NULL OR aclu.uid = 0) AND ( r.vid = 5 )ORDER BY v.weight, t.weight, t.name in /home/soanis/public_html/modules/taxonomy/taxonomy.module on line 618.
PostgreSQL 8.3 no longer allows automatic type casting as per this comment:http://groups.drupal.org/node/9103#comment-28800
The query you have above fails most likely because of the JOIN of
LEFT JOIN acl acl ON acl.name = t.tid because acl.name is a
VARCHAR and t.tid is an INTEGERYou should post to the issue queue for forum_access and/or acl to address this. All
that should be needed here is to CAST the tid to CHAR such as:LEFT JOIN acl acl ON acl.name = CAST(t.tid AS CHAR)
As per the above suggestion, I changed line 346 of forum_access.module to:
$sql['join'] = "LEFT JOIN {forum_access} fa ON $primary_table.tid = fa.tid LEFT JOIN {acl} acl ON acl.name = CAST($primary_table.tid AS CHAR) AND acl.module = 'forum_access' LEFT JOIN {acl_user} aclu ON aclu.acl_id = acl.acl_id AND aclu.uid = $user->uid";
and everything seems to work with no errors.
Comments
Comment #1
salvisAnalysis by jaydub in http://drupal.org/node/128846#comment-815488
Committed to 6.x-1.x-dev and 5.x-1.x-dev.
Thanks!
Comment #2
Anonymous (not verified) commentedAutomatically closed -- issue fixed for two weeks with no activity.