select * from note where noteKey = 1
此语句给我以下错误。
ERROR: column "notekey" does not exist
LINE 1: select * from note where noteKey = 1
^
HINT: Perhaps you meant to reference the column "note.noteKey".
我尝试了Note.notekey,但有同样的错误。(顺便说一句,我使用了postico,而notekey是表注的主要键)。
该语句可能有什么问题?
您需要与PSQL连接并运行d note
。
如果该列显示了用大写K
称为noteKey
,则您有两个选项
- 重命名列
ALTER TABLE note RENAME COLUMN "noteKey" TO notekey;
- 永远使用双引号
"
对其进行查询。
在postgresql中,我们从不引用列名。这迫使他们对帽子敏感。当不引用时,它们会自动降低壳体。
这个
select * from note where noteKey = 1
与
相同select * from note where notekey = 1
与
不同select * from note where "noteKey" = 1