当 运行 select where to='...' 时出现错误

Getting error when running select where to='...'

正在尝试 运行 形式为

的 psql 查询
Select * from x where to='...'

'to'是保留字吗?好像不太喜欢

"to" 确实是 reserved word in PostgreSQL,因为它在 SQL-92、SQL:1999 和 SQL:2003.[=12 的 ANSI 标准中=]

如果绝对必要,您可以使用双引号 (") 将其转义,但我建议您只为您的列找到一个非保留名称:

SELECT *
FROM   x
WHERE  "to" = 3
-- Here^--^

Select * 从 x where [to] ='...'