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

CREATE TABLE/DATABASE .. CHARSET .. COLLATE is not consistent on errors

    XMLWordPrintable

Details

    • Bug
    • Status: Closed (View Workflow)
    • Major
    • Resolution: Fixed
    • 10.2, 10.3, 10.4, 10.5, 10.6, 10.7, 10.8, 10.9
    • 10.9.2
    • Character Sets, Parser
    • None

    Description

      Table and database level CHARACTER SET and COLLATE clauses can go in any order. So both these syntaxes are correct:

      • CHARACTER SET .. COLLATE
      • COLLATE .. CHARACTER SET

      But they can produce errors differently:

      CREATE OR REPLACE TABLE t1 (a CHAR) COLLATE latin1_bin CHARACTER SET DEFAULT;
      

      ERROR 1302 (HY000): Conflicting declarations: 'CHARACTER SET latin1' and 'CHARACTER SET DEFAULT'
      

      CREATE OR REPLACE  TABLE t1 (a CHAR) CHARACTER SET DEFAULT COLLATE latin1_bin;
      

      Query OK, 0 rows affected (0.014 sec)
      

      The same problem is repeatable on the database level:

      CREATE OR REPLACE DATABASE db1 COLLATE latin1_bin CHARACTER SET DEFAULT;
      

      ERROR 1302 (HY000): Conflicting declarations: 'CHARACTER SET latin1' and 'CHARACTER SET DEFAULT'
      

      CREATE OR REPLACE DATABASE db1 CHARACTER SET DEFAULT COLLATE latin1_bin;
      

      Query OK, 0 rows affected (0.014 sec)
      

      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:
                Resolved:

                Git Integration

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