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

ALTER TABLE ... RENAME COLUMN syntax

    XMLWordPrintable

Details

    Description

      To rename a column, MariaDB provides this syntax:

      ALTER TABLE <table_name> CHANGE COLUMN old_name new_name column_definition
      

      which requires re-specification of all the attributes of the column.

      Disadvantages of the above syntax :

      • All the column information might not be available to the application trying to
        do the rename.
      • There is a risk of accidental data type change in the above syntax which might
        result in data loss.

      The proposed syntax, supported by MySQL 8.0, Oracle and PostgreSQL, is:

      ALTER TABLE <table_name> RENAME COLUMN old_name TO new_name;
      

      The new proposed syntax is expected to behave the same as "ALTER TABLE ...
      CHANGE" command used to rename column, without changing column attributes.

      The old syntax "ALTER TABLE ... CHANGE" to rename the column will continue
      to work.

      MySQL tickets: WL#10761, WL#6555

      Attachments

        Issue Links

          Activity

            People

              midenok Aleksey Midenkov
              quique Enrique Matías Sánchez
              Votes:
              5 Vote for this issue
              Watchers:
              5 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.