Make WordPress Core

Opened 9 years ago

Closed 9 years ago

#32081 closed defect (bug) (fixed)

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

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


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 9 years ago.

Download all attachments as: .zip

Change History (4)

9 years ago


#1 @boonebgorges
9 years ago

  • Keywords has-patch needs-unit-tests added
  • Milestone changed from Awaiting Review to 4.3

Thanks for the report, and good call.

#2 @obenland
9 years ago

  • Owner set to boonebgorges
  • Status changed from new to assigned

#3 @boonebgorges
9 years ago

  • Resolution set to fixed
  • Status changed from assigned to 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.