Every time I create a taxonewsblock on our website I get the following user warning:
user warning: 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 'DISTINCT(n.nid)) FROM term_node tn INNER JOIN node n ON tn.nid = n.nid WHERE tn.' at line 1 query: SELECT COUNT(t DISTINCT(n.nid)) FROM term_node tn INNER JOIN node n ON tn.nid = n.nid WHERE tn.tid = 60 AND n.status = 1 AND tn.nid NOT IN (1231510851,1231510390,1231403310,1231403143,1231317667,1231317057,1231237645,1231234126,1231233918,1231168059,1230895104,1230293661,1229874226,1229501520,1229420232,1229416405,1229415222,1229337828,1229337563,1229337356,1229337034,1229335076,1229334463,1229333747,1229332783,1229332133) LIMIT 0, 1 in /usr/home/neo1327/public_html/includes/database.mysql.inc on line 174.
The taxonewsblock itself appears on screen but on every page I get this user warning?
I'm using the taxonews-5.x-1.x-dev of the taxonews module on a drupal 5 website.
Comments
Comment #1
fgmStrange indeed. Can you reproduce it on a clean install ?
Comment #2
tomgoossens commentedI've just reproduced it on a clean localhost install. I get the same user waring after I turn on a taxonews block.
Comment #3
fgmThis is really strange: the error mentions a SELECT DISTINCT, and this construct is not present at all in the Taxonews code.
It looks like some module is implementing
hook_db_rewrite_sqland causingdb_rewrite_sqlto fail. Can you try to disable all non-core modules and see if this still happens ? If it doesn't, reenable one module at a time, to see when the problem reappears. Node access control modules often cause such problems, OG included.FWIW, the query thus broken appears to be the one in
Taxonews::archiveExists(). You can also comment outdb_rewrite_sql()in that function, which should be a workaround to avoid the problem caused by the other module, but then of course you won't have complete access control enabled on Taxonews.Comment #4
fgmCannot reproduce: please disable all contrib modules, and check what happens. Usual suspects would be any node access module, including OG.
Comment #5
tomgoossens commentedI've disabled all the contrib modules and I keep getting the user waring untill I disable the taxonews module. So I presume the bug is in de taxonewsmodule itself and not in the interaction with other modules???
Comment #6
fgmAs I said, I am unable to reproduce the error you describe, and taxonews does not include any DISTINCT request, so the error is caused by some other code modifying its requests.
What I suggested was to comment out the
db_rewrite_sql()line in Taxonews::archiveExists(). This should remove the problem. If it does, this will confirm the problem is with another module implementing hook_db_rewrite_sql(). If it doesn't, I have absolutely no idea, and I will need (much) more information to help.Comment #7
fgmNo answer from user after one month. Assuming problem fixed.
Comment #9
r_nanda_k commentedHi,
I commented db_rewrite_sql() line as you have mentioned. It worked fine for me.
Thanks
Nanda
Comment #10
fgmThanks for your confirmation. Also, remember that by commenting that line, what you do is actually disable access control for that Taxonews block, which potentially means showing terms which *could* be blocked by the access control module you are using.
Comment #11
fgmMight be fixable in a more general way like other db_rewrite_sql/DISTINCT bugs. Adding tag.
Comment #12
fgmCore issue fixed in 6.16, not yet fixed in 5.22 (patch available at http://drupal.org/node/284392#comment-1773074 ), so today's dev version includes a specific fix in Taxonews to avoid running into the core issue.