[wp-trac] [WordPress Trac] #30681: Using a value in a meta_query (in WP_Query) combined with EXISTS OR NOT EXISTS breaks query

WordPress Trac noreply at wordpress.org
Thu Dec 11 22:08:44 UTC 2014


#30681: Using a value in a meta_query (in WP_Query) combined with EXISTS OR NOT
EXISTS breaks query
--------------------------+--------------------
 Reporter:  barrykooij    |       Owner:
     Type:  defect (bug)  |      Status:  new
 Priority:  normal        |   Milestone:  4.1
Component:  General       |     Version:  trunk
 Severity:  normal        |  Resolution:
 Keywords:                |     Focuses:
--------------------------+--------------------

Comment (by barrykooij):

 Replying to [comment:1 johnbillion]:
 > To clarify, the current code results in an invalid WHERE clause that
 looks like this (note the empty brackets):
 >
 > `CAST(wp_postmeta.meta_value AS CHAR) NOT EXISTS '' )`
 >
 > We'll need some unit tests here to cover this.

 Not only is the appended 2 x single quotes incorrect, the whole where
 statement should not be added to the SQL chunks.

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


More information about the wp-trac mailing list