Opened 6 months ago
Last modified 6 months ago
#60503 new defect (bug)
MySQL VALUES function deprecated in MySQL 8
Reported by: |
|
Owned by: | |
---|---|---|---|
Milestone: | Awaiting Review | Priority: | normal |
Severity: | normal | Version: | |
Component: | Database | Keywords: | needs-patch |
Focuses: | Cc: |
Description
e.g. for add_option SQL query (but issue happens in other places too, but not many)
"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.
Change History (3)
#2
@
6 months ago
- Component changed from General to Database
- Focuses performance php-compatibility removed
- Keywords needs-patch added
- Severity changed from blocker to normal
- Version trunk deleted
#3
@
6 months ago
You're right - the description of https://make.wordpress.org/hosting/handbook/compatibility/#wordpress-php-mysql-mariadb-versions is slightly confusing in that regard (and you have to scroll all the way to the bottom)
Anyway, it's possible to make this work correctly without a deprecation notice in MySQL 8 as well as in MySQL 5.
The fact that WP 6.4 states it recommends MySQL 8.0-8.2 but then causes deprecation errors isn't really consistent, is it?
8.0 or greater is only a recommendation. Requirement is 5.5.5 or greater, which was bumped from 5.0 in [57173].