Closed (fixed)
Project:
Google Sitemap
Version:
5.x-1.10
Component:
Code
Priority:
Normal
Category:
Bug report
Assigned:
Unassigned
Reporter:
Created:
15 Jun 2007 at 23:51 UTC
Updated:
25 Oct 2007 at 18:41 UTC
Jump to comment: Most recent file
Comments
Comment #1
darren ohHere's a patch for the 5.x version. I couldn't think of a reason to add table aliases where we're not using db_rewrite_sql(), so I didn't. Please let me know if it solves the problem.
Comment #2
darren ohI don't get any errors, so I'm committing without review. Fixed in CVS commit 83790.
Comment #3
basby commentedThanks for the patch. I have installed it on my system (drupal 5.2, gsitemap-5.x-1.10) because I received the following error when submitting a post to the forum, a story or whatever:
user warning: Unknown column 'term_data.tid' in 'on clause' query: SELECT COUNT(*) FROM xxxterm_data td LEFT JOIN xxxforum_access fa ON term_data.tid = fa.tid LEFT JOIN xxxacl acl ON acl.name = term_data.tid AND acl.module = 'forum_access' LEFT JOIN xxxacl_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) in
Installing the patch did not solve the problem. I had to change something more (additional to the patch). I changed all occurrences of 'term_data' to 'td' EXCEPT for one:
$output .= _gsitemap_sublinks($additional, 'term_data', 'tid', $range, $previous_links);
So do not change anything in this line!
The results of applying the patch and my changes is shown in the following line (this is only 1 of many lines that is changed):
Original line:
$count = db_result(db_query(db_rewrite_sql('SELECT COUNT(*) FROM {term_data}', 'term_data', 'tid')));
After applying the patch:
$count = db_result(db_query(db_rewrite_sql('SELECT COUNT(*) FROM {term_data} td', 'term_data', 'tid')));
After applying my changes:
$count = db_result(db_query(db_rewrite_sql('SELECT COUNT(*) FROM {term_data} td', 'td', 'tid')));
The result of my changes was that the warning disappeared and the problem is solved.
Comment #4
AjK commentedPlease don't change descriptive titles to something totally non-descript
Comment #5
darren ohIt turns out that this whole issue exists because the primary table name needs to be in curly braces (not documented). I went with aliases because it's cleaner. Fixed in CVS commit 84038.
Comment #6
(not verified) commented