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

InnoDB: Changing a Column Data Type from VARCHAR/TEXT to a super type causes a unexpected Table Rebuild

    XMLWordPrintable

Details

    Description

      CREATE OR REPLACE TABLE t1(a INT PRIMARY KEY, data TEXT CHARACTER SET utf8mb4 COLLATE utf8mb4_bin) ENGINE=InnoDB;
      --error ER_ALTER_OPERATION_NOT_SUPPORTED_REASON
      ALTER TABLE t1 MODIFY data LONGTEXT CHARACTER SET utf8mb4 COLLATE utf8mb4_bin, ALGORITHM=INSTANT;
      

      InnoDB does not distinguish between VARCHAR, TINYTEXT, TEXT, MEDIUMTEXT, LONGTEXT internally.
      As long as the maximum length does not become smaller, the conversion can be done on the metadata level, without table rebuild (and without even validating the contents of the table).

      Attachments

        Issue Links

          Activity

            People

              bar Alexander Barkov
              bar Alexander Barkov
              Votes:
              0 Vote for this issue
              Watchers:
              1 Start watching this issue

              Dates

                Created:
                Updated:

                Git Integration

                  Error rendering 'com.xiplink.jira.git.jira_git_plugin:git-issue-webpanel'. Please contact your Jira administrators.