未找到Postgresql列,但显示在描述中
也有类似的帖子,但都没有帮我解决问题 我试图对一个表进行简单的选择,只检索一列。该列显示在descripe表中,但当我尝试选择它时,会出现一个列not found错误。我正在使用命令行界面 表格:未找到Postgresql列,但显示在描述中,sql,postgresql,quoted-identifier,Sql,Postgresql,Quoted Identifier,也有类似的帖子,但都没有帮我解决问题 我试图对一个表进行简单的选择,只检索一列。该列显示在descripe表中,但当我尝试选择它时,会出现一个列not found错误。我正在使用命令行界面 表格: id | integer | not null default amazon_payment_id | integer | not null source
id | integer | not null default
amazon_payment_id | integer | not null
source | character varying(10) | not null
timestamp | timestamp with time zone | not null
status | character varying(50) | not null
statusReason | character varying(100) | not null
transactionId | character varying(50) | not null
transactionDate | timestamp with time zone |
transactionAmount | numeric(6,2) |
errorMessage | character varying(100) | not null
ERROR: column "transactionamount" does not exist
LINE 1: select `transactionAmount` from ... where...
等等
选择:
select `transactionAmount` from ... where ... group by transactionAmount;
错误:
id | integer | not null default
amazon_payment_id | integer | not null
source | character varying(10) | not null
timestamp | timestamp with time zone | not null
status | character varying(50) | not null
statusReason | character varying(100) | not null
transactionId | character varying(50) | not null
transactionDate | timestamp with time zone |
transactionAmount | numeric(6,2) |
errorMessage | character varying(100) | not null
ERROR: column "transactionamount" does not exist
LINE 1: select `transactionAmount` from ... where...
有人知道我为什么会收到这个错误吗?为什么在列名中使用
`
您可以在不使用任何引号字符的情况下使用它,而使用引号字符时,它可能区分大小写。同样,这样的引号字符是“
,而不是`
因此,请使用:
select "transactionAmount"
from ...
where ...
group by "transactionAmount";
有关标识符的信息,请访问:为什么在列名中使用
`
您可以在不使用任何引号字符的情况下使用它,而使用引号字符则可能区分大小写。同样,这种引号字符是“
,而不是”
因此,请使用:
select "transactionAmount"
from ...
where ...
group by "transactionAmount";
有关标识符的信息,请访问:谢谢。作为最后的手段,我尝试了反勾号,我没有想到双引号。双引号帮我修正了。谢谢。作为最后的手段,我尝试了反勾号,我没有想到双引号。双引号帮我解决了这个问题。