这是我的表 web_book 的方案:
Column | Type | Modifiers
----------------+------------------------+-------------------------------------------------------
id | integer | not null default nextval('web_book_id_seq'::regclass)
page_count | integer | not null
year_published | integer | not null
file | character varying(100) | not null
image | character varying(100) | not null
display_on_hp | boolean | not null
name | character varying(128) | not null
description | text | not null
name_cs | character varying(128) |
name_en | character varying(128) |
description_cs | text |
description_en | text |
该表包含一行,其中id=3
. 我想复制该行,但如果我尝试这个:
INSERT INTO web_book SELECT * FROM web_book WHERE id=3;
我明白了:
ERROR: duplicate key value violates unique constraint "web_book_pkey"
DETAIL: Key (id)=(3) already exists