Make WordPress Core

Opened 12 years ago

Closed 12 years ago

#32081 closed defect (bug) (fixed)

comments query w/ meta_value and comments__in returns clause is ambiguous db error

Reported by: willgladstone Owned by: boonebgorges
Priority: normal Milestone: 4.3
Component: Comments Version: 4.1.2
Severity: normal Keywords: has-patch needs-unit-tests
Cc: Focuses:

Description

using comments__in in a comment query does not work when also querying the comment meta table as the column name becomes ambiguous. Appending the db table name to the column name will fix it.

Attachments (1)

comment.diff​ (975 bytes ) - added by willgladstone 12 years ago.
Patch

Download all attachments as: .zip

Change History (4)

#1 @boonebgorges
12 years ago

  • Keywords has-patch needs-unit-tests added
  • Milestone Awaiting Review → 4.3

Thanks for the report, and good call.

#2 @obenland
12 years ago

  • Owner set to boonebgorges
  • Status new → assigned

#3 @boonebgorges
12 years ago

  • Resolution → fixed
  • Status assigned → closed

In 32461:

Use table prefix for comment__in and comment__not_in SQL clauses of WP_Comment_Query.

The prefix prevents ambiguity when joining against other tables.

Props willgladstone.
Fixes #32081.

Note: See TracTickets for help on using tickets.