Closed (fixed)
Project:
Token
Version:
5.x-1.12
Component:
Code
Priority:
Critical
Category:
Bug report
Assigned:
Reporter:
Created:
2 Jun 2009 at 13:11 UTC
Updated:
8 Jun 2010 at 13:56 UTC
Jump to comment: Most recent file
file "token_node.inc" v 1.3.2.28 2009/05/14 16:11:00
116 line:
$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 weight", $vid, $object->vid, 0, 1));
replace on
$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.nid = %d ORDER BY weight", $vid, $object->vid, 0, 1));
Table "term_node" does't have a field "vid".
| Comment | File | Size | Author |
|---|---|---|---|
| #1 | token_node_mysql_term_node.inc_.patch | 983 bytes | perusio |
Comments
Comment #1
perusio commentedSame problem here. Patch attached.
Comment #2
tmail1 commentedAfter updating the Token module to 5.x-1.12 I noticed a problem when submitting new content. I got the following error:
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 = 4 AND r.vid = 866 ORDER BY weight LIMIT 0, 1 in /var/www/includes/database.mysql.inc on line 174.
After applying this patch the message stopped appearing.
To apply the patch I did as follows:
cd /var/www/sites/all/modules/token
wget http://drupal.org/files/issues/token_node_mysql_term_node.inc_.patch
patch < token_node_mysql_term_node.inc_.patch
Comment #3
mariuss commentedI can also confirm that the patch fixes the problem.
Comment #4
dr00b commentedThank you for your efforts, the patch worked beautifully here as well.
Comment #5
michelle@perusio: Thanks for the patch. Why did you set it "to be ported"? Is this a problem in D6 as well?
I confirmed the patch works on my client's site as well. I think we have a RTBC consensus here.
Michelle
Comment #6
hongpong commentedJust confirming also having this issue. is the patch rolled into Dev yet? going to get bugged abt this if i can't get rid of it, don't want to patch the module ;-)
Are there any effects from this bug, or is it just a random error message kinda thing? thx for all the work, Token's really a nice module :)
Comment #7
crookednumber commentedI can also confirm. Patch removes this SQL error.
Comment #8
fgmThe problem is that terms are per-revision in D6 but only per-node in D5, and 5.1.12 apparently backported this from the latest 6.x update.
It needs to be checked, but I *think* that the patch is not correct: subject to rereading, it should probably use $object->nid instead of $object->vid, and the difference won't be noticed unless you happen to actually use revisions on your nodes.
Comment #9
fgmThe problem is that terms are per-revision in D6 but only per-node in D5, and 5.1.12 apparently backported this from the latest 6.x update.
It needs to be checked, but I *think* that the patch is not correct: subject to rereading, it should probably use $object->nid instead of $object->vid, and the difference won't be noticed unless you happen to actually use revisions on your nodes.
Comment #10
gregglesThanks for the work here, folks. I committed the patch from #485346: SQL query error (saw that issue before this one). It has the improvement that fgm noted.
New release soon...sorry about this bug.
Comment #11
Uppa commentedIs it necessary to apply the patch? Or can I just wait for a later version? Or should I get back to the older version? I am no good at applying patches and if this warning is just a bother in itself but doesn't cause problems i'd rather leave it as it is for the moment. Thanks Claudia
Comment #12
gregglesPlease upgrade at http://drupal.org/node/488728
Comment #14
argosmm commentedI can also confirm that the patch fixes the problem.
Comment #15
dave reidFixed with #821238: backport from Drupal 6.x brought another "term vid" issues