Alter Table Primary key - Crate DB

前端 未结 2 1745
慢半拍i
慢半拍i 2021-01-27 10:40

I want to alter a table in my Crate DB to change the primary key constraint to add a column to the existing one. If I need to drop the constraint and create a n

2条回答
  •  猫巷女王i
    2021-01-27 11:23

    there's no way to alter the primary key once a table has been created. You need to create a new table that has the schema you'd like to have and then either move the data over with COPY TO and COPY FROM or with insert into to_table (i) (select ... from t). With CrateDB > 2.0 it's also possible to rename tables, so you can still use the original table name.

提交回复
热议问题