[wp-trac] [WordPress Trac] #16812: Taxonomy queries without joins ignore order by

WordPress Trac wp-trac at lists.automattic.com
Thu Mar 10 14:28:21 UTC 2011


#16812: Taxonomy queries without joins ignore order by
-----------------------------------------+------------------------------
 Reporter:  Chad Killingsworth           |       Owner:  scribu
     Type:  defect (bug)                 |      Status:  reviewing
 Priority:  normal                       |   Milestone:  Awaiting Review
Component:  Query                        |     Version:  3.1
 Severity:  normal                       |  Resolution:
 Keywords:  has-patch reporter-feedback  |
-----------------------------------------+------------------------------
Changes (by Chad Killingsworth):

 * cc: chadkilllingsworth@… (added)


Comment:

 I have a test instance setup and I disabled all plugins before I began
 testing/debugging the issue. I agree with your statement about the
 strangeness of the group by/order by conflict. The SQL Statement including
 the group by clause looks perfectly valid to me and I don't understand why
 it would affect post ordering in any way.

 Here's the query variables and request output:

 {{{
 Array
 (
     [cat] => -1
     [feed] => atom
     [error] =>
     [m] => 0
     [p] => 0
     [post_parent] =>
     [subpost] =>
     [subpost_id] =>
     [attachment] =>
     [attachment_id] => 0
     [name] =>
     [static] =>
     [pagename] =>
     [page_id] => 0
     [second] =>
     [minute] =>
     [hour] =>
     [day] => 0
     [monthnum] => 0
     [year] => 0
     [w] => 0
     [category_name] =>
     [tag] =>
     [tag_id] =>
     [author_name] =>
     [tb] =>
     [paged] => 0
     [comments_popup] =>
     [meta_key] =>
     [meta_value] =>
     [preview] =>
     [s] =>
     [sentence] =>
     [fields] =>
     [category__in] => Array
         (
         )

     [category__not_in] => Array
         (
             [0] => 1
         )

     [category__and] => Array
         (
         )

     [post__in] => Array
         (
         )

     [post__not_in] => Array
         (
         )

     [tag__in] => Array
         (
         )

     [tag__not_in] => Array
         (
         )

     [tag__and] => Array
         (
         )

     [tag_slug__in] => Array
         (
         )

     [tag_slug__and] => Array
         (
         )

     [meta_query] => Array
         (
         )

     [ignore_sticky_posts] =>
     [suppress_filters] =>
     [cache_results] => 1
     [update_post_term_cache] => 1
     [update_post_meta_cache] => 1
     [post_type] =>
     [posts_per_page] => 10
     [nopaging] =>
     [comments_per_page] => 50
     [no_found_rows] =>
     [order] => DESC
     [orderby] => wp_1_posts.post_date DESC
 )
  SELECT SQL_CALC_FOUND_ROWS  wp_1_posts.* FROM wp_1_posts  WHERE 1=1  AND
 ( wp_1_posts.ID NOT IN (
                                         SELECT object_id
                                         FROM wp_1_term_relationships
                                         WHERE term_taxonomy_id IN (1)
                                 ) ) AND wp_1_posts.post_type = 'post' AND
 (wp_1_posts.post_status = 'publish' OR wp_1_posts.post_status = 'private')
 GROUP BY wp_1_posts.ID ORDER BY wp_1_posts.post_date DESC LIMIT 0, 10
 }}}

-- 
Ticket URL: <http://core.trac.wordpress.org/ticket/16812#comment:6>
WordPress Trac <http://core.trac.wordpress.org/>
WordPress blogging software


More information about the wp-trac mailing list