gpt4 book ai didi

postgresql - "user"PostgreSQL 附近的语法错误,即使引用了用户

转载 作者:行者123 更新时间:2023-11-29 14:15:59 24 4
gpt4 key购买 nike

在 postgres 上获取这个:

syntax error at or near ""user""

对于以下内容:

insert into "user" ("id", "email") values ('1', 'foo@example.com') on conflict do update "user" set "id" = '1', "email" = 'foo@example.com'

玩了一段时间,不知道语法错误在哪里。感谢您的帮助。

最佳答案

显然,您不能在 ON CONFLICT UPDATE SET 子句中指定表名。以下似乎有效:

insert into "user" ("id", "email") values ('1', 'foo@example.com')
on conflict do update set "id" = '1', "email" = 'foo@example.com'

syntax here :

....
DO UPDATE SET { column_name = { expression | DEFAULT } |
( column_name [, ...] ) = ( { expression | DEFAULT } [, ...] ) |
( column_name [, ...] ) = ( sub-SELECT )
} [, ...]
[ WHERE condition ]

关于postgresql - "user"PostgreSQL 附近的语法错误,即使引用了用户,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/47850268/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com