User warning: Unknown column 'n.type'
| Project: | Drigg |
| Version: | 6.x-1.x-dev |
| Component: | Code |
| Category: | bug report |
| Priority: | normal |
| Assigned: | Unassigned |
| Status: | closed |
Jump to:
Hi, thanks a lot for the module, I'm gonna have fun with this ;)
I installed Drigg manually over Drupal 6.8, following the procedure from drigg-code.org/pages/download_and_install.
When I go, as admin, in Administer - Taxonomy - List terms for Tags, I get this error:
user warning: Unknown column 'n.type' in 'where clause' query: SELECT count(*) FROM term_data t INNER JOIN term_hierarchy h ON t.tid = h.tid LEFT JOIN drigg_node dn2 ON dn2.dnid = n.nid WHERE ( 1=1 AND !(n.type='drigg' AND dn2.killed = 1 ) ) AND ( t.vid = 100) in /home/myuser/public_html/drigg/modules/taxonomy/taxonomy.admin.inc on line 282.
The problem seems to come from the file /modules/drigg/drigg/drigg.module :
$return['where'] .= " AND !(n.type='drigg' AND dn2.killed = 1 ) ";
$return['join'] .= " LEFT JOIN {drigg_node} dn2 ON dn2.dnid = n.nid ";The problem arises only for Tags (taxonomy/2). No problem with Category (taxonomy/1).
Any help would be appreciated. Thanks.

#1
Hi,
This is _strange_.
I have this in the rewrite:
<?php// This will only filter node lists
if ($primary_table == 'n' && $primary_field == 'nid') {
?>
This means that the rewrite should really only happen when a query with a node is done.
At the same time, why would Drupal core make such a silly mistake?
Can you tell me which URL you are visiting precisely when you get this error?
I am looking for that query but I can't find it:
root@merc-laptop:/home/www/drupal/current_6# grep -il "SELECT count(*) FROM {term_data}" `find .`root@merc-laptop:/home/www/drupal/current_6#
I am confused!
Merc.
#2
The exact url where I get the error is: /admin/content/taxonomy/2
And the count(*) query is in taxonomy.admin.inc.
You know what, I think the drigg_db_rewrite_sql hook receives default values from database.inc :
function db_rewrite_sql($query, $primary_table = 'n', $primary_field = 'nid', $args = array())Can you reproduce the problem ?
#3
Hi,
I must be going insane...
Sorry about being inept, but can you tell me where the query is in taxonomy.admin.inc ?
Merc.
#4
Hehe, working during the holidays can be tough ;) No stress, the bug is not a show stopper.
It's in function "taxonomy_overview_terms", line 282. See the error message in my first post. I'm also running Drupal 6.8.. maybe they changed something recently.
A quick fix in the filter/rewrite (drigg_db_rewrite_sql) could be to check if we're in /admin using the $args parameter.
Merry Christmas :))
Eric
#5
Hi,
If you change that line into:
$total_entries = db_query(db_rewrite_sql('SELECT count(*) FROM {term_data} t INNER JOIN {term_hierarchy} h ON t.tid = h.tid WHERE t.vid = %d','t','tid'), $page_increment, 0, NULL, $vocabulary->vid);
Does that fix the problem?
If the answer is "yes", you will need to report the problem to Drupal Core, since this is basically a Drupal Core bug (in the taxonomy module).
Bye,
Merc.
#6
Hi,
Can somebody confirm this problem with the latest Drupal?
Or has this gone away?
At the time, I suspected that it could possibly be a core problem...
Merc.
#7
I confirm this problem no longer happens on drupal 6.14 and latest 6.x dev version of drigg. This can be closed.
#8
#9
Automatically closed -- issue fixed for 2 weeks with no activity.