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".

CommentFileSizeAuthor
#1 token_node_mysql_term_node.inc_.patch983 bytesperusio

Comments

perusio’s picture

Status: Needs review » Patch (to be ported)
StatusFileSize
new983 bytes

Same problem here. Patch attached.

tmail1’s picture

After 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

mariuss’s picture

I can also confirm that the patch fixes the problem.

dr00b’s picture

Thank you for your efforts, the patch worked beautifully here as well.

michelle’s picture

Status: Patch (to be ported) » Reviewed & tested by the community

@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

hongpong’s picture

Just 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 :)

crookednumber’s picture

I can also confirm. Patch removes this SQL error.

fgm’s picture

Status: Reviewed & tested by the community » Needs review

The 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.

fgm’s picture

The 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.

greggles’s picture

Status: Needs review » Fixed

Thanks 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.

Uppa’s picture

Is 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

greggles’s picture

Status: Fixed » Closed (fixed)

Automatically closed -- issue fixed for 2 weeks with no activity.

argosmm’s picture

I can also confirm that the patch fixes the problem.

dave reid’s picture