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

ALTER COLUMN IF EXISTS .. causes syntax error

    XMLWordPrintable

Details

    • 10.1.31

    Description

      In the scope of MDEV-318, ALTER TABLE was extended to allow IF [NOT] EXISTS clauses, including those for MODIFY COLUMN and CHANGE COLUMN. However, ALTER COLUMN does not accept it:

      MariaDB [test]> create table t1 (i int);
      Query OK, 0 rows affected (0.26 sec)
       
      MariaDB [test]> alter table t1 change column if exists a b int;
      Query OK, 0 rows affected, 1 warning (0.00 sec)
      Records: 0  Duplicates: 0  Warnings: 1
       
      MariaDB [test]> alter table t1 alter column if exists a set default 1;
      ERROR 1064 (42000): You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'if exists a set default 1' at line 1
      MariaDB [test]> select @@version;
      +-----------------------+
      | @@version             |
      +-----------------------+
      | 10.0.34-MariaDB-debug |
      +-----------------------+
      1 row in set (0.00 sec)
      

      The task doesn't say anything about it being left out intentionally, so I suppose it's an omission.

      Attachments

        Activity

          People

            holyfoot Alexey Botchkov
            elenst Elena Stepanova
            Votes:
            0 Vote for this issue
            Watchers:
            2 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.