[wp-trac] Re: [WordPress Trac] #8022: non-DISTINCT query in get_archives for postbypost

WordPress Trac wp-trac at lists.automattic.com
Thu Dec 11 03:54:21 GMT 2008


#8022: non-DISTINCT query in get_archives for postbypost
----------------------+-----------------------------------------------------
 Reporter:  kevinB    |        Owner:  anonymous
     Type:  defect    |       Status:  reopened 
 Priority:  low       |    Milestone:           
Component:  Template  |      Version:  2.8      
 Severity:  normal    |   Resolution:           
 Keywords:            |  
----------------------+-----------------------------------------------------
Changes (by kevinB):

  * status:  closed => reopened
  * version:  2.7 => 2.8
  * resolution:  invalid =>

Comment:

 By "filterable" I mean able to use the two filters which are already
 applied in the wp_get_archives() function.

 The getarchives_join filter is unusable with a postbypost comments listing
 because joining another table to a SELECT * query can cause redundant
 result rows.  In practice, to implement my desired join I would have to
 run a followup 'query' filter to change the queried fields from * to
 DISTINCT $wpdb->comments.*  Instead I have just instructed any affected
 users to hack their general-template.php as in the attached patch.

 The problem of redundant results from joined data (which serves a
 filtering purpose but may not be intended for display) is why the main
 WP_Query::get_posts query includes a posts_distinct (and posts_fields)
 filter.  I thought two new filters just for postbypost comments would be
 perceived as design overkill, but if you prefer to go that way that's
 fine.

 I will let you re-close this ticket and/or start another now that I've
 explained myself.  When I get time I'll check back and open another ticket
 if the problem is not yet resolved.

-- 
Ticket URL: <http://trac.wordpress.org/ticket/8022#comment:3>
WordPress Trac <http://trac.wordpress.org/>
WordPress blogging software


More information about the wp-trac mailing list