[wp-trac] [WordPress Trac] #60503: MySQL VALUES function deprecated in MySQL 8

WordPress Trac noreply at wordpress.org
Mon Feb 12 12:19:23 UTC 2024


#60503: MySQL VALUES function deprecated in MySQL 8
--------------------------------------------+-----------------------------
 Reporter:  kkmuffme                        |      Owner:  (none)
     Type:  defect (bug)                    |     Status:  new
 Priority:  normal                          |  Milestone:  Awaiting Review
Component:  General                         |    Version:  trunk
 Severity:  blocker                         |   Keywords:
  Focuses:  performance, php-compatibility  |
--------------------------------------------+-----------------------------
 e.g. for add_option SQL query (but issue happens in other places too, but
 not many)

 {{{#!php
 "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`)"
 }}}


 we get the SQL logs spammed with:

 >'VALUES function' is deprecated and will be removed in a future release.
 Please use an alias (INSERT INTO ... VALUES (...) AS alias) and replace
 VALUES(col) in the ON DUPLICATE KEY UPDATE clause with alias.col instead

 Since WP 6.4 minimum SQL is 8+, so this deprecated syntax isn't necessary
 anymore, since the new syntax is supported in all supported SQL versions.

 This should have been fixed in WP 6.4, but at least now with WP 6.5
 release, as it's easy to fix and avoid having a performance penalty from
 the deprecation notice handling/reporting.

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


More information about the wp-trac mailing list