[wp-trac] [WordPress Trac] #36649: Right-hand CAST in a MySQL query produces DB error
WordPress Trac
noreply at wordpress.org
Sat Apr 23 14:49:01 UTC 2016
#36649: Right-hand CAST in a MySQL query produces DB error
--------------------------+-----------------------------
Reporter: ericlewis | Owner:
Type: defect (bug) | Status: new
Priority: normal | Milestone: Awaiting Review
Component: Query | Version:
Severity: normal | Keywords:
Focuses: |
--------------------------+-----------------------------
A right-hand CAST like this
{{{
#!php
<?php
add_action( 'init', function() {
global $wpdb;
$r = $wpdb->get_results( "SELECT * FROM $wpdb->postmeta WHERE
meta_value=CAST('default' AS CHAR);");
});
}}}
produces this error
{{{
WordPress database error: [Illegal mix of collations
(utf8mb4_unicode_ci,IMPLICIT) and (utf8mb4_general_ci,IMPLICIT) for
operation '=']
SELECT * FROM wp_postmeta WHERE meta_value=CAST('default' AS CHAR);
}}}
--
Ticket URL: <https://core.trac.wordpress.org/ticket/36649>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform
More information about the wp-trac
mailing list