找不到Postgresql列,但显示为描述 [英] Postgresql Column Not Found, But Shows in Describe
问题描述
也有类似的帖子,但是没有一个可以帮助我解决我的问题。
There have been similar posts, but none helped me solve my problem.
我试图在一个表上进行简单选择,只检索一个列。该列显示在describe表中,但是当我尝试选择它时,出现一列not found错误。我正在使用命令行界面。
I am trying to do a simple select on a table, retrieving only one column. The column shows in the describe table, but when I try to select it I get a column not found error. I am using the command line interface.
表:
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
等。
选择:
select `transactionAmount` from ... where ... group by transactionAmount;
错误:
ERROR: column "transactionamount" does not exist
LINE 1: select `transactionAmount` from ... where...
有人知道我为什么会收到此错误吗?
Does anyone have any idea why I would receive this error?
推荐答案
为什么在列名中使用`
?
您可以不带引号使用它字符,而带引号的字符可能区分大小写。同样,这样的报价字符为 ,而不是
`
You can use it without any quote characters, while with quote characters it may be case sensitive. Also such quote char is "
, and not `
因此使用:
select "transactionAmount"
from ...
where ...
group by "transactionAmount";
有关标识符的信息,请参见: http://www.postgresql.org/docs/current/static/sql-syntax-lexical.html
Read about identifiers at: http://www.postgresql.org/docs/current/static/sql-syntax-lexical.html
这篇关于找不到Postgresql列,但显示为描述的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!