[wp-trac] [WordPress Trac] #27272: WP meta queries comparing apples to oranges
WordPress Trac
noreply at wordpress.org
Tue Mar 4 16:22:45 UTC 2014
#27272: WP meta queries comparing apples to oranges
-------------------------------+-----------------------------
Reporter: Denis-de-Bernardy | Owner:
Type: defect (bug) | Status: new
Priority: normal | Milestone: Awaiting Review
Component: Query | Version: 3.7.1
Severity: normal | Keywords:
Focuses: |
-------------------------------+-----------------------------
As seen when hooking into the `posts_selection` hook while debugging a
site:
{{{
( (ts_wp_postmeta.meta_key = 'financial_max_annual' AND
CAST(ts_wp_postmeta.meta_value AS SIGNED) <= '100000') )
}}}
The thing that led to that was:
{{{
$meta_query[] = array(
'key' => $meta_key,
'value' => $max_fee,
'compare' => '<=',
'type' => 'NUMERIC',
);
}}}
Can I suggest that, when we CAST, we do so on both sides?
--
Ticket URL: <https://core.trac.wordpress.org/ticket/27272>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform
More information about the wp-trac
mailing list