我有一个表(test
),其中包含以下字段:
id (text)
msg (text)
result (bytea)
其中id
被定义为索引
我正在运行以下查询:
insert into test(id, result)
values ('t1', 't-res')
on conflict (id) do update
set result = 't-res'
但是我得到了:
there is no unique or exclusion constraint matching the on conflict specification
答案 0 :(得分:1)
您应将id
设置为主键(问题中未填写)。