I updated to the latest release od 5.x-2.x-dev and started recieving the following error...

user warning: Unknown column 'r.vid' in 'where clause' query: SELECT t.vid FROM term_node r INNER JOIN term_data t ON r.tid = t.tid INNER JOIN vocabulary v ON t.vid = v.vid WHERE r.vid = 119 ORDER BY v.weight, t.weight, t.name LIMIT 0, 1 in /var/www/html/www.exmaple.co.uk/drupal-5/includes/database.mysqli.inc on line 156.

I found the culprit... In this block:

          // Get taxonomy related data.
          $vid = db_result(db_query_range("SELECT t.vid FROM {term_node} r INNER JOIN {term_data} t ON r.tid = t.tid INNER JOIN {vocabulary} v ON t.vid = v.vid WHERE r.vid = %d ORDER BY v.weight, t.weight, t.name", $object->vid, 0, 1));
          $category = db_fetch_object(db_query_range("SELECT t.tid, t.name FROM {term_data} t INNER JOIN {term_node} r ON r.tid = t.tid WHERE t.vid = %d AND r.nid = %d ORDER BY weight", $vid, $object->nid, 0, 1));
          $category->vid = $vid;
          // In the realm of nodes these are terms, in the realm of Taxonomy, cats
          $label = 'term';

The $vid = db_result.... section should have WHERE r.nid = %d and $object->nid... Not vid as used here.

I'd do you a patch, but my current export of pathauto is also modified for improved "feed" additions to the taxonomy term aliases.

Comments

greggles’s picture

Status: Needs review » Closed (duplicate)

Ah, right...terms don't have revisions in D5. Bummer. See #423132: Incorrect retrival of node's taxonomy terms with revisions for more info.

jadwigo’s picture

resting’s picture

user warning: Unknown column 'r.vid' in 'where clause' query: SELECT t.tid, t.name FROM term_data t INNER JOIN term_node r ON r.tid = t.tid WHERE t.vid = 1 AND r.vid = 15 ORDER BY t.weight LIMIT 0, 1 in /var/www/vhosts/*****/includes/database.mysql.inc on line 174.

I'm having this error whenever I create a new forum topic. Slight difference to the posted error of this issue.
Have not seen it anywhere else till now.

I'm using token 5.x-1.14. So I guess this http://drupal.org/node/485346 does not affect me?
What should I do to make the error go away??

Actually I wonder is it a pathauto module or token module's problem...hmm...

Using DP 5.22

resting’s picture

What does this line do??

$term = db_fetch_object(db_query_range("SELECT t.tid, t.name FROM {term_data} t INNER JOIN {term_node} r ON r.tid = t.tid WHERE t.vid = %d AND 
r.vid = %d ORDER BY t.weight", $vid, $object->vid, 0, 1));

Line 98: token_node.inc

The error is gone after changning r.vid to r.nid. But I've no idea what implications it might bring. Any comments?

eporama’s picture

For Token-5.14, they backported some from token-6.x and introduced errors, it's fixed in token on CVS and will be brought forward, I assume.

http://drupal.org/node/821238.

Don't want to move this issue to token or mark as fixed as the original issue was for a different problem...