[wp-trac] Re: [WordPress Trac] #9167: query_posts('meta_key=foo')
returns duplicate posts
WordPress Trac
wp-trac at lists.automattic.com
Thu Feb 19 18:33:22 GMT 2009
#9167: query_posts('meta_key=foo') returns duplicate posts
--------------------------+-------------------------------------------------
Reporter: scribu | Owner: anonymous
Type: defect (bug) | Status: new
Priority: normal | Milestone: 2.7.2
Component: General | Version:
Severity: normal | Keywords: has-patch
--------------------------+-------------------------------------------------
Comment(by filosofo):
Replying to [comment:18 scribu]:
> Come to think of it, you don't need to SELECT ''any'' field from
wp_postmeta when querying either by meta_key, or meta_value or both,
right?
Right. That's why my patch at #9177 removes the select for the only
wp_postmeta field currently selected: meta_value.
> Only then a GROUP BY wouldn't be necessary.
The GROUP BY (or a DISTINCT) is still necessary in the multiple meta_key
scenario because wp_postmeta is joined to wp_posts, no matter what is
selected.
--
Ticket URL: <http://core.trac.wordpress.org/ticket/9167#comment:19>
WordPress Trac <http://trac.wordpress.org/>
WordPress blogging software
More information about the wp-trac
mailing list