[wp-trac] [WordPress Trac] #54669: Remove ONLY_FULL_GROUP_BY from incompatible wpdb modes

WordPress Trac noreply at wordpress.org
Mon Dec 9 19:59:19 UTC 2024


#54669: Remove ONLY_FULL_GROUP_BY from incompatible wpdb modes
-------------------------+------------------------------
 Reporter:  malthert     |       Owner:  (none)
     Type:  enhancement  |      Status:  closed
 Priority:  normal       |   Milestone:  Awaiting Review
Component:  Database     |     Version:  3.9
 Severity:  normal       |  Resolution:  invalid
 Keywords:  close        |     Focuses:
-------------------------+------------------------------
Changes (by OllieJones):

 * keywords:  needs-patch needs-unit-tests => close
 * status:  new => closed
 * resolution:   => invalid


Comment:

 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.

-- 
Ticket URL: <https://core.trac.wordpress.org/ticket/54669#comment:4>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform


More information about the wp-trac mailing list