Make WordPress Core

Opened 3 years ago

Closed 6 weeks ago

Last modified 2 weeks ago

#54669 closed enhancement (wontfix)

Remove ONLY_FULL_GROUP_BY from incompatible wpdb modes

Reported by: malthert's profile malthert Owned by:
Milestone: Priority: normal
Severity: normal Version: 3.9
Component: Database Keywords:
Focuses: Cc:

Description

as GROUP BY is non-deterministic otherwise, ONLY_FULL_GROUP_BY ensures this is not the case.
which is why this is enabled by default since MySQL 8

I guess it was disabled originally, as some queries would have to be updated in WP core.

I think however, this should be done now, as otherwise we're accumulating more and more technical debt.

Change History (5)

#1 @johnbillion
3 years ago

  • Keywords needs-patch needs-unit-tests added
  • Type changed from defect (bug) to enhancement
  • Version trunk deleted

#2 @SergeyBiryukov
3 years ago

  • Version set to 3.9

Thanks for the ticket!

Introduced in [27072] / #26847, see comment:2:ticket:26847 for context.

Related: #44586, #48280, #48377, #49344

This ticket was mentioned in Slack in #core by abhanonstopnews. View the logs.


3 years ago

#4 @OllieJones
6 weeks ago

  • Keywords close added; needs-patch needs-unit-tests removed
  • Resolution set to invalid
  • Status changed from new to closed

Investigated. Here's how this works.

WordPress turns off ONLY_FULL_GROUP_BY mode if it is on by default in the MariaDB / MySQL database server configuration. (It does the same for 'NO_ZERO_DATE', 'STRICT_TRANS_TABLES', 'STRICT_ALL_TABLES', 'TRADITIONAL', and 'ANSI' modes).

If we stop turning off ONLY_FULL_GROUP_BY we cause various plugins (among them WooCommerce) to start throwing 1140 errors as well as other group by errors. So we can't just take this out of core without breaking plugins.

A plugin or theme author who wants to remediate their legacy use of MySQL's nonstandard permissive GROUP BY functionality can test by using the incompatible_sql_modes filter to remove the 'ONLY_FULL_GROUP_BY' element from the list of modes to turn off.

But they'd best avoid leaving that filter in place when releasing their code.

Last edited 6 weeks ago by OllieJones (previous) (diff)

#5 @desrosj
2 weeks ago

  • Keywords close removed
  • Milestone Awaiting Review deleted
  • Resolution changed from invalid to wontfix
Note: See TracTickets for help on using tickets.