After installing filter_by_taxo, I placed a side block and this is the message I got:
user warning: Unknown table 'n' in on clause query: SELECT DISTINCT tn.tid FROM term_node tn INNER JOIN term_data td ON td.tid = tn.tid LEFT JOIN localizernode loc ON loc.nid=n.nid WHERE (loc.locale IN ('es','-') OR loc.locale IS NULL) AND ( NOT (tn.tid IN (5) ) AND (tn.nid IN (24)) AND (td.vid = 5)) in (suppressed)/drupal-5.0/includes/database.mysql.inc on line 167.
I see there is a
n.nid
that shoule be
tn.nid
I understand it must be an error from refine by taxo, although I see lots of localizer references in the text, might it be another module's bug? I get no error if I remove refinement blocks.
Comments
Comment #1
Bèr Kessels commentedThe part 'LEFT JOIN localizernode loc ON loc.nid=n.nid WHERE' comes from another module, one I don't know about frankly. That is the module creating the wrong SQL, so I am re-assigning this, and will be following along with the conversation within that projet.
Comment #2
bès commentedI got the same bug when i use the admin account.
It disappears when i deactivate the Localizer node module.
I try with a normal user and i got a similar error :
INNER JOIN d5_node_access na ON na.nid = n.nid
should be
INNER JOIN d5_node_access na ON na.nid = tn.nid ?
this time the error comes from node module...
File node.module, function _node_access_join_sql()
Comment #3
Roberto Gerola commentedWhat module are you using ?
It seems to me that this module use the call db_rewrite_sql method, but doesn't pass the correct
primary table. If no primary table is specified the default is n, i.e., node.
The primary table that it should pass should be 'tn' instead.
Comment #4
bès commentedIn my case, I got the both bug after installing the 'Refine by taxonomy' module.
As i got the bug with two different module (node and localizernode), I also think that the problem comes from passing argument.
Comment #5
Roberto Gerola commentedIn refine_by_taxo.module :
$sql = db_escape_string('SELECT DISTINCT tn.tid FROM {term_node} tn INNER JOIN {term_data} td ON td.tid = tn.tid WHERE' . $conditions);
$result = db_query(db_rewrite_sql($sql));
The use of db_rewrite_sql is not correct, it should be : db_rewrite_sql($sql, 'tn', tid)
The parameters are explained here : http://api.drupal.org/api/HEAD/function/db_rewrite_sql
Comment #6
Farreres commentedSorry, roberto. Do you mean this is a refine_by_taxo bug? Could you then move this bug to this other module so they know it?
Comment #7
Roberto Gerola commentedIn refine_by_taxo.module :
191: $sql = db_escape_string('SELECT DISTINCT tn.tid FROM {term_node} tn INNER JOIN {term_data} td ON td.tid = tn.tid WHERE' . $conditions);
192 : $result = db_query(db_rewrite_sql($sql));
The use of db_rewrite_sql function is not correct, it should be : db_rewrite_sql($sql, 'tn', 'tid')
Please, correct this, otherwise other modules cannot work correctly.
The parameters are explained here : http://api.drupal.org/api/HEAD/function/db_rewrite_sql
Comment #8
Roberto Gerola commentedComment #9
Bèr Kessels commentedassigning to myself.
Comment #10
Farreres commentedhas it been finally fixed?
Comment #11
pacesie commentedThis bug makes the module unusable for me. Is there a patch?
Comment #12
robertgarrigos commentedI got rid of that error with this patch, although I'm having some other funny results.
Comment #13
Bèr Kessels commented"funny results": does that mean that we must wait a bit untill you find out what is wrong?
Comment #14
robertgarrigos commentednop, this is something realted to the other patch I posted (http://drupal.org/node/120271) which I din't know at the time I posted this one here. The funny results were due to the fact that this module was limiting the search query to the number of nodes set with the feed_default_items variable, so you might have funny results. For me this patch here is ready to commit but I would like someone else could confirm this, so changing this to 'needs review'.
Comment #15
blackjaw@pseudolife.com commentedThis fixed everything on my site. Thanks guys!\
http://www.pseudolife.com
Comment #16
marcoBauli commentedPatch above worked fine here too :)
(changing title as it fixed same problem with Localizer)
Comment #17
JHeffner commentedPatch worked as well. Though I had problems finding this bug page since it wasn't specific to Localizer. Changing title to make it easier to find since it's specific to this module.
Comment #18
Bèr Kessels commentedcode looks good.
Comment #19
JHeffner commentedCan you commit this? I ran into it again as soon as I upgraded to the latest version.
Comment #20
Bèr Kessels commentedcommitted to 5.x dev version.
Comment #21
Anonymous (not verified) commentedAutomatically closed -- issue fixed for two weeks with no activity.