[wp-trac] [WordPress Trac] #48756: Missing support for VALUE() function in MariaDB >= 10.3?

WordPress Trac noreply at wordpress.org
Thu Nov 21 19:22:03 UTC 2019


#48756: Missing support for VALUE() function in MariaDB >= 10.3?
--------------------------+-----------------------------
 Reporter:  robertscheck  |      Owner:  (none)
     Type:  defect (bug)  |     Status:  new
 Priority:  normal        |  Milestone:  Awaiting Review
Component:  Database      |    Version:  5.3
 Severity:  normal        |   Keywords:
  Focuses:                |
--------------------------+-----------------------------
 I might be wrong but it seems like WordPress 5.3 (and trunk as of writing)
 seem to miss support for MariaDB 10.3 due to incompatible changed
 `VALUES()` function. It's important to not mix up the `VALUES()` function
 with the `VALUES` keyword from the `INSERT` keyword (see: also
 https://mariadb.com/kb/en/library/values-value/).

 https://mariadb.com/kb/en/library/upgrading-from-mariadb-102-to-
 mariadb-103/#functions says:

 > As a result of implementing Table Value Constructors, the VALUES
 function has been renamed to VALUE().

 A simple `grep` through WordPress 5.3 sources leads me to:

 {{{
 $ grep -r "VALUES(" *
 wp-includes/taxonomy.php:                       if ( false ===
 $wpdb->query( "INSERT INTO $wpdb->term_relationships (object_id,
 term_taxonomy_id, term_order) VALUES " . join( ',', $values ) . ' ON
 DUPLICATE KEY UPDATE term_order = VALUES(term_order)' ) ) {
 wp-includes/option.php: $result = $wpdb->query( $wpdb->prepare( "INSERT
 INTO `$wpdb->options` (`option_name`, `option_value`, `autoload`) VALUES
 (%s, %s, %s) ON DUPLICATE KEY UPDATE `option_name` =
 VALUES(`option_name`), `option_value` = VALUES(`option_value`), `autoload`
 = VALUES(`autoload`)", $option, $serialized_value, $autoload ) );
 wp-includes/SimplePie/Cache/MySQL.php:
 $query = $this->mysql->prepare('INSERT INTO `' .
 $this->options['extras']['prefix'] . 'cache_data` (`id`, `items`, `data`,
 `mtime`) VALUES(:feed, :count, :data, :time)');
 wp-includes/SimplePie/Cache/MySQL.php:
 $query = $this->mysql->prepare('INSERT INTO `' .
 $this->options['extras']['prefix'] . 'items` (`feed_id`, `id`, `data`,
 `posted`) VALUES(:feed, :id, :data, :date)');
 wp-includes/SimplePie/Cache/MySQL.php:
 $query = $this->mysql->prepare('INSERT INTO `' .
 $this->options['extras']['prefix'] . 'cache_data` (`id`, `items`, `data`,
 `mtime`) VALUES(:id, 0, :data, :time)');
 $
 }}}

 Based on the `grep` output, I would say the following files are affected:

   * `wp-includes/taxonomy.php`
   * `wp-includes/option.php`

 Given MySQL seems to stay with the `VALUES()` function and MariaDB >= 10.3
 starts using `VALUE()` function (older MariaDB versions will stay with the
 old `VALUES()` function as well), this likely needs some MySQL/MariaDB
 version specific conditional code.

-- 
Ticket URL: <https://core.trac.wordpress.org/ticket/48756>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform


More information about the wp-trac mailing list