数据仓库服务 GaussDB(DWS)-向表中插入数据报错:duplicate key value violates unique constraint "%s":问题现象

时间:2025-02-12 15:02:21

问题现象

向表中插入数据报错:duplicate key value violates unique constraint "%s"。

 1 2 3 4 5 6 7 8 9101112131415
CREATE TABLE films (code        char(5) PRIMARY KEY,title       varchar(40) NOT NULL,did         integer NOT NULL,date_prod   date,kind        varchar(10),len         interval hour to minute);NOTICE:  CREATE TABLE / PRIMARY KEY will create implicit index "films_pkey" for table "films"CREATE TABLEINSERT INTO films VALUES ('UA502', 'Bananas', 105, DEFAULT, 'Comedy', '82 minutes');INSERT INTO films VALUES ('UA502', 'Bananas', 105, '1971-07-13', 'Comedy', '82 minutes');ERROR:  dn_6003_6004: duplicate key value violates unique constraint "films_pkey"DETAIL:  Key (code)=(UA502) already exists.
support.huaweicloud.com/trouble-dws/dws_09_0123.html