hgolov hgolov - 3 months ago 9x
SQL Question

Postgresql Column Not Found, But Shows in Describe

Thanks for taking the time to look at my question.

There have been similar posts, but nothing that helped solve my problem.

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?

Thanks again.


Why do you use ` in column name?

You can use it without any quote characters, while with quote characters it may be case sensitive. Also such quote char is ", and not `

So use:

select "transactionAmount" 
from ... 
where ... 
group by "transactionAmount";

Read about identifiers at: http://www.postgresql.org/docs/current/static/sql-syntax-lexical.html