postgres - 在(列表)中的位置 - 列不存在 [英] postgres - where in (list) - column does not exist
本文介绍了postgres - 在(列表)中的位置 - 列不存在的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我来自 SQL Server,但惊讶地发现以下查询不起作用:
I'm coming from SQL Server and I was suprised to see that the following query does not work:
DELETE FROM user_job_titles WHERE id IN (
"c836d018-1d12-4507-a268-a4d80d6d3f54",
"d0961a90-7d31-4c4c-9c1b-671115e3d833",
"62dda420-6e62-4017-b41d-205c0aa82ead"
)
其中 user_job_titles 具有以下列:
where user_job_titles has the following columns:
id
user_id
job_title_id
错误是:
ERROR: column "c836d018-1d12-4507-a268-a4d80d6d3f54" does not exist
LINE 2: "c836d018-1d12-4507-a268-a4d80d6d3f54"
我正在使用 pgAdmin 和最新的 postgresql 版本.还有其他方法可以运行此查询吗?
I'm using pgAdmin with latest postgresql version. Is there any other way to run this query?
推荐答案
对字符串常量使用单引号:
Use single quotes for string constants:
DELETE FROM user_job_titles
WHERE id IN ('c836d018-1d12-4507-a268-a4d80d6d3f54',
'd0961a90-7d31-4c4c-9c1b-671115e3d833',
'62dda420-6e62-4017-b41d-205c0aa82ead'
);
双引号是用于表名和列名的转义字符.因此出现错误.
Double quotes are an escape character used with table and column names. Hence the error.
这篇关于postgres - 在(列表)中的位置 - 列不存在的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文