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

Incorrect syntax returned for column with CHECK constraint in the "SHOW CREATE TABLE ..." result

    XMLWordPrintable

    Details

      Description

      Consider the below example,

      1)Create the below table,

      CREATE TABLE `t1` (`name` VARCHAR(30) CHECK (CHAR_LENGTH(`name`)>2), `start_date` DATE, `end_date` DATE COMMENT 'DATE COLUMN' CHECK (`start_date` is NULL OR `end_date` is NULL OR `start_date`<`end_date`));

      2) Execute "SHOW CREATE TABLE `t1`"

      3) Copy the result returned by the query executed in Step-2.

      4) Execute the copied query in Step-3 after renaming the table name

      5) The query execution will fail due to incorrect syntax. The issue is "COMMENT" column_definition comes after the 'CHECK' constraint_definition. Refer the MariaDB create table syntax >> https://mariadb.com/kb/en/library/create-table/

        Attachments

          Activity

            People

            • Assignee:
              anel Anel Husakovic
              Reporter:
              Sibin Sibin
            • Votes:
              0 Vote for this issue
              Watchers:
              4 Start watching this issue

              Dates

              • Created:
                Updated: