繁体   English   中英

psql列不存在但它确实存在

[英]psql column doesn't exist but it does

我试图在psql命令行的postgresql数据库中使用原始SQL在我的数据表中选择一个列。 我收到一条错误消息,指出该列不存在。 然后它给我一个提示,使用我在select语句中引用的确切列。 这是查询:

SELECT insider_app_ownershipdocument.transactionDate FROM insider_app_ownershipdocument;

这是错误消息:

ERROR:  column insider_app_ownershipdocument.transactiondate does not exist
SELECT insider_app_ownershipdocument.transactionDate FROM in...
HINT:  Perhaps you meant to reference the column "insider_app_ownershipdocument.transactionDate".

我不知道为什么这不起作用。

(Postgres)SQL将名称自动转换为小写,尽管它支持区分大小写的名称。 所以

SELECT insider_app_ownershipdocument.transactionDate FROM insider_app_ownershipdocument;

将符合以下条件:

SELECT insider_app_ownershipdocument.transactiondate FROM insider_app_ownershipdocument;

您应该使用双引号保护列名称以避免此效果:

SELECT insider_app_ownershipdocument."transactionDate" FROM insider_app_ownershipdocument;

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM