Sql 冲突集列引用上的Postgres不明确
我有一张桌子:Sql 冲突集列引用上的Postgres不明确,sql,postgresql,upsert,Sql,Postgresql,Upsert,我有一张桌子: create table c ( e text not null, m text not null, p numeric not null, PRIMARY KEY (e, m) ); 我想进行插入或更新,将p添加到现有值: insert into c values (...) on conflict (e, m) do update set p = p + excluded.p 我得到一个错误: 错误:列引用“p”不明
create table c (
e text not null,
m text not null,
p numeric not null,
PRIMARY KEY (e, m)
);
我想进行插入或更新,将p
添加到现有值:
insert into c values (...) on conflict (e, m) do update set
p = p + excluded.p
我得到一个错误:
错误:列引用“p”不明确
怎么会模棱两可?我应该如何编写insert来将
excluded.p
添加到已存在的值中?您可能需要:
p = c.p + excluded.p
您可能希望:
p = excluded.p + excluded.p
您需要指定