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

CONVERT TO CHARACTER SET does not work if there are no columns to convert

    XMLWordPrintable

Details

    Description

      Found on stackoverflow.

      MariaDB [test]> create table t1 (i int) charset latin1;
      Query OK, 0 rows affected (0.43 sec)
       
      MariaDB [test]> alter table t1 convert to character set utf8;
      Query OK, 0 rows affected (0.00 sec)
      Records: 0  Duplicates: 0  Warnings: 0
       
      MariaDB [test]> show create table t1 \G
      *************************** 1. row ***************************
             Table: t1
      Create Table: CREATE TABLE `t1` (
        `i` int(11) DEFAULT NULL
      ) ENGINE=InnoDB DEFAULT CHARSET=latin1
      1 row in set (0.00 sec)
      

      This works:

      MariaDB [test]> alter table t1 convert to character set utf8, force;
      Query OK, 0 rows affected (1.16 sec)
      Records: 0  Duplicates: 0  Warnings: 0
       
      MariaDB [test]> show create table t1 \G
      *************************** 1. row ***************************
             Table: t1
      Create Table: CREATE TABLE `t1` (
        `i` int(11) DEFAULT NULL
      ) ENGINE=InnoDB DEFAULT CHARSET=utf8
      1 row in set (0.00 sec)
      

      This also works:

      MariaDB [test]> alter table t1 convert to character set utf8, algorithm=copy;
      Query OK, 0 rows affected (1.16 sec)
      Records: 0  Duplicates: 0  Warnings: 0
       
      MariaDB [test]> show create table t1 \G
      *************************** 1. row ***************************
             Table: t1
      Create Table: CREATE TABLE `t1` (
        `i` int(11) DEFAULT NULL
      ) ENGINE=InnoDB DEFAULT CHARSET=utf8
      1 row in set (0.00 sec)
      

      And this:

      MariaDB [test]> create table t1 (c char) charset latin1;
      Query OK, 0 rows affected (0.33 sec)
       
      MariaDB [test]> alter table t1 convert to character set utf8;
      Query OK, 0 rows affected (1.18 sec)               
      Records: 0  Duplicates: 0  Warnings: 0
       
      MariaDB [test]> show create table t1 \G
      *************************** 1. row ***************************
             Table: t1
      Create Table: CREATE TABLE `t1` (
        `c` char(1) DEFAULT NULL
      ) ENGINE=InnoDB DEFAULT CHARSET=utf8
      1 row in set (0.00 sec)
      

      Not reproducible on MySQL 5.6-5.7.

      Attachments

        Activity

          People

            Unassigned Unassigned
            elenst Elena Stepanova
            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.