[wp-trac] [WordPress Trac] #49364: dbDelta() should not change display width for integer data types on MySQL 8.0.17+

WordPress Trac noreply at wordpress.org
Wed Mar 9 10:38:48 UTC 2022


#49364: dbDelta() should not change display width for integer data types on MySQL
8.0.17+
----------------------------+---------------------
 Reporter:  SergeyBiryukov  |       Owner:  (none)
     Type:  defect (bug)    |      Status:  new
 Priority:  normal          |   Milestone:  6.0
Component:  Database        |     Version:
 Severity:  normal          |  Resolution:
 Keywords:  has-patch       |     Focuses:
----------------------------+---------------------

Comment (by SergeyBiryukov):

 Replying to [comment:12 JavierCasares]:
 > I'm having this problems with MariaDB 10.5.
 >
 > https://make.wordpress.org/hosting/test-results/r52797/wpsabot-r52797/
 >
 > I think this may be related with
 >
 > {{{
 > @@SQL_MODE:
 STRICT_TRANS_TABLES,ERROR_FOR_DIVISION_BY_ZERO,NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION
 > }}}
 >
 > Mainly: STRICT_TRANS_TABLES. MariaDB 10.2.4+ has the STRICT_TRANS_TABLES
 by default...

 Thanks! I'm not sure it's related to `STRICT_TRANS_TABLES` though, as
 WordPress specifically disables this and other incompatible modes as of
 [27072] / #26847.

 It's interesting that the failure messages are the exact opposite of what
 I had in the ticket description.

 MySQL 8.0.17 changes from `bigint(20)` to `bigint`:
 {{{
 Tests_dbDelta::test_column_type_change
 Failed asserting that two arrays are equal.
 --- Expected
 +++ Actual
 @@ @@
  Array (
 -    'wptests_dbdelta_test.id' => 'Changed type of wptests_dbdelta_test.id
 from bigint(20) to int(11)'
 +    'wptests_dbdelta_test.id' => 'Changed type of wptests_dbdelta_test.id
 from bigint to int(11)'
  )
 }}}

 MariaDB 10.5.15 changes from `bigint` to `bigint(20)`:
 {{{
 Tests_dbDelta::test_column_type_change
 Failed asserting that two arrays are identical.
 --- Expected
 +++ Actual
 @@ @@
  Array &0 (
 -    'wptests_dbdelta_test.id' => 'Changed type of wptests_dbdelta_test.id
 from bigint to int(11)'
 +    'wptests_dbdelta_test.id' => 'Changed type of wptests_dbdelta_test.id
 from bigint(20) to int(11)'
  )
 }}}

 It also looks like the same tests do successfully pass on another host:
 https://make.wordpress.org/hosting/test-results/r52797/cloudingbot-r52797/

 I think the test changes in [47184] may need some adjustment, specifically
 this check:
 {{{
 if ( version_compare( $db_version, '8.0.17', '<' ) ) {
         // Prior to MySQL 8.0.17, default width of 20 digits was used:
 BIGINT(20).
         $this->bigint_display_width = '(20)';
 }
 }}}
 However, it's not quite clear to me why this works for me locally with
 MariaDB 10.4.12, as well as on some hosts with MariaDB 10.5.15, but not on
 the one with the failures.

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


More information about the wp-trac mailing list