这是我面临的奇怪问题。我正在尝试使用以下查询输入数据
insert into product_product
(id, product_tmpl_id, make_equip, model_equip, name_template, serial_num_equip, location_equip, issue_date_equip, issue_to_equip, remarks_equip, pr, ch, categ_id,valuation)
values (700,700,'Nikon','Action 10x50 Lookout','Nikon Action 10x50 Lookout','671386','40 Wall St.','5/13/2004 12:00:00 AM','','OM''s OFFICE',62,72,502,'manual periodic');
Run Code Online (Sandbox Code Playgroud)
我收到错误:
ERROR: duplicate key value violates unique constraint "product_product_pkey"
DETAIL: Key (id)=(700) already exists.
********** Error **********
ERROR: duplicate key value violates unique constraint "product_product_pkey"
SQL state: 23505
Detail: Key (id)=(700) already exists.
Run Code Online (Sandbox Code Playgroud)
我在该记录上运行选择查询,如下所示:
select * from product_product
where id=700
Run Code Online (Sandbox Code Playgroud)
它返回没有数据的列(数据也包括 id)
我尝试像这样运行更新查询:
update product_product set
product_tmpl_id=700,
make_equip='Nikon',
model_equip='Action 10x50 …Run Code Online (Sandbox Code Playgroud)