databasegoogle-cloud-platformdatabase-schemagoogle-cloud-spanner

Is it possible to rename columns?


Is it possible to issue something like

RENAME COLUMN col1 col2

in Google Cloud Spanner? It looks from the DDL that this isn't possible; if not, is this a design choice or a limitation whilst in Beta?


Solution

  • No, this is not possible. Currently you can only do the following with regard to altering columns in a table:

    A work around is possible by following these steps in order:

    Keep in mind the above steps will not work for the primary key column, you'll have to do by creating a new table, and doing the data migration that way.