[wp-trac] [WordPress Trac] #25775: WP_Date_Query table prefixing

WordPress Trac noreply at wordpress.org
Fri Oct 17 01:19:05 UTC 2014


#25775: WP_Date_Query table prefixing
-------------------------------------+---------------------------
 Reporter:  ew_holmes                |       Owner:  boonebgorges
     Type:  defect (bug)             |      Status:  closed
 Priority:  normal                   |   Milestone:  4.1
Component:  Query                    |     Version:  3.7
 Severity:  major                    |  Resolution:  fixed
 Keywords:  has-patch needs-testing  |     Focuses:
-------------------------------------+---------------------------
Changes (by boonebgorges):

 * owner:   => boonebgorges
 * status:  new => closed
 * resolution:   => fixed


Comment:

 In [changeset:"29933"]:
 {{{
 #!CommitTicketReference repository="" revision="29933"
 Use table aliases for columns in SQL generated by WP_Date_Query.

 The use of non-aliased column names (eg 'post_date' instead of
 'wp_posts.post_date')
 in WP_Date_Query causes SQL notices and other failures when queries
 involve
 table joins, such as date_query combined with tax_query or meta_query.
 This
 changeset modifies WP_Date_Query::validate_column() to add the table alias
 when
 it can be detected from the column name (ie, in the case of core columns).

 A side effect of this change is that it is now possible to use
 WP_Date_Query
 to build WHERE clauses across multiple tables, though there is currently
 no
 core support for the automatic generation of the necessary JOIN clauses.
 See

 Props ew_holmes, wonderboymusic, neoxx, Viper007Bond, boonebgorges.
 Fixes #25775.
 }}}

--
Ticket URL: <https://core.trac.wordpress.org/ticket/25775#comment:37>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform


More information about the wp-trac mailing list