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

constraint name in column constraints

    XMLWordPrintable

Details

    Description

      According to the sql standard the following is valid command:

      CREATE TABLE Table_1 ( 
        column_1 SMALLINT 
            CONSTRAINT constraint_1 CHECK(column_1<400), 
        column_2 CHAR(5));
      

      Oracle grammar examples indicate the same:

      CREATE TABLE employees_demo
          ( employee_id    NUMBER(6)
          , first_name     VARCHAR2(20)
          , last_name      VARCHAR2(25) 
               CONSTRAINT emp_last_name_nn_demo NOT NULL
          , email          VARCHAR2(25) 
               CONSTRAINT emp_email_nn_demo     NOT NULL
      ...
      

      But both 10.2.6 and 10.3.0 show syntax error:

      mysql> CREATE TABLE Table_1 ( 
          ->   column_1 SMALLINT 
          ->       CONSTRAINT constraint_1 CHECK(column_1<400), 
          ->   column_2 CHAR(5));
      ERROR 1064 (42000): You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'CONSTRAINT constraint_1 CHECK(column_1<400), 
        column_2 CHAR(5))' at line 3
      

      Attachments

        Issue Links

          Activity

            People

              Unassigned Unassigned
              anikitin Andrii Nikitin (Inactive)
              Votes:
              0 Vote for this issue
              Watchers:
              3 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.