For some reason I ran into this bug

user warning: Column 'name' in where clause is ambiguous query: SELECT t.tid, t.* FROM term_data t LEFT JOIN term_data catd ON t.tid = catd.tid WHERE (t.tid IN (0) OR catd.vid NOT IN (1)) AND LOWER('b') LIKE LOWER(name) in /someplace/includes/database.mysql.inc on line 120.

when calling taxonomy_get_term_by_name().

This is the problem in the code (taxonomy.module line 1012):

  $db_result = db_query(db_rewrite_sql("SELECT t.tid, t.* FROM {term_data} t WHERE LOWER('%s') LIKE LOWER(name)", 't', 'tid'), trim($name));

And should be replaced by:

  $db_result = db_query(db_rewrite_sql("SELECT t.tid, t.* FROM {term_data} t WHERE LOWER('%s') LIKE LOWER(t.name)", 't', 'tid'), trim($name));

(LOWER(name) changed into LOWER(t.name))

kind regards,
-- Steven

CommentFileSizeAuthor
#2 taxonomy.module.4.7.0.patch613 bytesdeepstar

Comments

gerhard killesreiter’s picture

Status: Reviewed & tested by the community » Active

not a patch

deepstar’s picture

Status: Active » Reviewed & tested by the community
StatusFileSize
new613 bytes

Here you go

killes@www.drop.org’s picture

Version: 4.7.0 » x.y.z

Thanks, please try to create patches from the root directory.

applied

drumm’s picture

Status: Reviewed & tested by the community » Fixed

Committed to HEAD

Anonymous’s picture

Status: Fixed » Closed (fixed)