Getting the following SQL error:

You have an error in your SQL syntax; check the manual that corresponds to your
MySQL server version for the right syntax to use near ') AND n.status = 1 ORDER BY
sticky DESC, created DESC LIMIT 4' a query: SELECT DISTINCT(n.nid), n.title, r.body,
sticky, created FROM term_node t INNER JOIN node n ON t.nid = n.nid INNER JOIN
node_revisions r ON r.vid = n.vid 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 t.tid IN () AND n.status = 1 ORDER BY sticky
DESC, created DESC LIMIT 4 in /opt/drupal-4.7.3/includes/database.mysql.inc on
line 120.

The issue seems to be in taxonomy_block_get_block - the $tids array is empty. This may well be either an interaction problem with taxonomy_access or a bug in the data in the database.

Adding

     if (count($tids) == 0) {
      return null;
    }

just before the $nodes query cures the symptom (anon gets no block due to no access, everyone else gets the block - only anon doesn't have access to the heirarchy) - but - I suspect that this should not be necessary?

Comments

angelahoistion’s picture

I had the same error message ("includes/database.mysql.inc on line 120.") and found this forum:

http://drupal.org/node/72394#comment-152137

that offered a easy fix (update the database!)...

drewish’s picture

i think that angelahoistion's problem is totally unrelated to this. my guess is that it's problems with the SQL.

drewish’s picture

Status: Active » Fixed

I've committed some fixes that will hopefully address this.

Anonymous’s picture

Status: Fixed » Closed (fixed)