Uploaded image for project: 'MariaDB Server'
  1. MariaDB Server
  2. MDEV-21359

Changing "LONGTEXT" column's collation (using ALTER TABLE ... CHANGE) truncates data after 65535 chars

    XMLWordPrintable

    Details

    • Type: Bug
    • Status: Closed (View Workflow)
    • Priority: Major
    • Resolution: Not a Bug
    • Affects Version/s: 10.0.38, 5.5.64, 10.4.10
    • Fix Version/s: N/A
    • Component/s: Character Sets, Data types
    • Labels:
      None
    • Environment:
      CentOS Linux 7.5.1804 (Core) (VPS Plesk environment), PHP 7.2.25

      Description

      Changing the collation of a LONGTEXT column (using ALTER TABLE ... CHANGE) truncates the data contained in it to exactly 65535 characters long (the max length of a TEXT type column?).

      I've confirmed/reproduced this with MariaDB 5.5.64 and 10.0.38. MySQL 5.6.13 doesn't experience this behaviour.

      The problematic query is in the form of:

      ALTER TABLE <table_name> CHANGE <column_name> <column_name> LONGTEXT CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL
      

      The following work fine/as expected:

      ALTER TABLE <table_name> MODIFY <column_name> LONGTEXT CHARACTER SET utf8mb4
      

      and:

      ALTER TABLE <table_name> CONVERT TO CHARACTER SET utf8mb4
      

      (The specific collation or the type of data contained in the LONGTEXT column doesn't seem to matter; I'm able to reproduce it every time. Also both InnoDB and MyISAM storage engines experience the same behaviour.)

      Side notes

      I originally posted this issue on PhpMyAdmin's github page and got directed here: https://github.com/phpmyadmin/phpmyadmin/issues/15670

      I hope I've included enough information.

        Attachments

          Activity

            People

            Assignee:
            Unassigned
            Reporter:
            marbbom Bram
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Dates

              Created:
              Updated:
              Resolved: