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

ALTER TABLE ... RENAME COLUMN/INDEX syntax

    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.

        Attachments

          Issue Links

            Activity

              People

              • Assignee:
                midenok Aleksey Midenkov
                Reporter:
                quique Enrique Matías Sánchez
              • Votes:
                1 Vote for this issue
                Watchers:
                4 Start watching this issue

                Dates

                • Created:
                  Updated: