1. 程式人生 > >postgresql修改主鍵的步驟

postgresql修改主鍵的步驟

–刪除主鍵
alter table dw_stg.stg_ord_fct_quote_items_info_mid drop CONSTRAINT stg_ord_fct_quote_items_info_mid_pkey;
–更改分佈鍵
alter table dw_stg.stg_ord_fct_quote_items_info_mid set distributed by(quote_item_id,ord_loc);
–新增主鍵
alter table dw_stg.stg_ord_fct_quote_items_info_mid add CONSTRAINT stg_ord_fct_quote_items_info_mid_pkey primary key(quote_item_id,ord_loc);