INSERT ON CONFLICT DO UPDATE SET
INSERT INTO customers (name, email)
VALUES('Microsoft','hotline@microsoft.com')
ON CONFLICT (name)
DO
UPDATE SET email = EXCLUDED.email || ';' || customers.email;
更新的字段 要用 EXCLUDED临时表或者 customers 原来的表 否则找不到字段
INSERT ON CONFLICT DO UPDATE SET
INSERT INTO customers (name, email)
VALUES('Microsoft','hotline@microsoft.com')
ON CONFLICT (name)
DO
UPDATE SET email = EXCLUDED.email || ';' || customers.email;
更新的字段 要用 EXCLUDED临时表或者 customers 原来的表 否则找不到字段