在postgres上获取此信息:
syntax error at or near ""user""
对于以下内容:
insert into "user" ("id", "email") values ('1', '[email protected]') on conflict do update "user" set "id" = '1', "email" = '[email protected]'
已经玩了一段时间,不知道语法错误在哪里。谢谢您的帮助。
显然,您无法在ON CONFLICT UPDATE SET
子句中指定表名。以下似乎有效:
insert into "user" ("id", "email") values ('1', '[email protected]')
on conflict do update set "id" = '1', "email" = '[email protected]'
....
DO UPDATE SET { column_name = { expression | DEFAULT } |
( column_name [, ...] ) = ( { expression | DEFAULT } [, ...] ) |
( column_name [, ...] ) = ( sub-SELECT )
} [, ...]
[ WHERE condition ]
在"user"
之后删除ON CONFLICT DO UPDATE
。