[wp-trac] [WordPress Trac] #27272: WP meta queries comparing apples to oranges

WordPress Trac noreply at wordpress.org
Mon Oct 20 17:01:42 UTC 2014


#27272: WP meta queries comparing apples to oranges
------------------------------------------+-----------------------------
 Reporter:  Denis-de-Bernardy             |       Owner:
     Type:  defect (bug)                  |      Status:  new
 Priority:  normal                        |   Milestone:  Future Release
Component:  Query                         |     Version:  3.8.1
 Severity:  normal                        |  Resolution:
 Keywords:  needs-patch needs-unit-tests  |     Focuses:
------------------------------------------+-----------------------------

Comment (by boonebgorges):

 >  The test currently fails miserably at step 3

 See [attachment:27272.test.patch]. It demonstrates that these queries do
 *not* currently fail for types SIGNED, NUMERIC, and DATETIME. Note that
 the key here is that, in each case, a 'type' is passed with the tax query
 clause. These same queries will fail if you don't pass an explicit 'type',
 because the cast will fall back on strings. But as long as you are
 manually handling the casting on one side of the comparison, MySQL will
 handle it on the other side.

 There is a further question about whether we should be kinder to
 developers, by assuming that they mean "SIGNED" when they pass a numeric
 'value' but don't specify the 'type'. IMO this would probably be a decent
 enhancement, but I think it's different from what's being suggested here.

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


More information about the wp-trac mailing list