Postgres: column “field” does not exist
Posted by Johan Cyprich on 01 Oct 2008 | Tagged as: Tech Tips
When I run the following SQL command in PostgreSQL:
select * from projects where Status=’Inactive’
I get the following error:
ERROR: column “status” does not exist
This is a very frustrating and confusing error because the same SQL command works in MS SQL Server and MySQL. After some research, I discovered that Postgres converts all column names in a table to lower case in a SQL query.
The problem can be fixed by enclosed a table name that has mixed case with double quotation marks:
select * from projects where “Status”=’Inactive’
The query will then work as expected.
| Related posts: | |
|
|
Share this post:
Follow Me:
Did you find this post interesting and useful? You can keep up to date on this blog by subscribing to my RSS feed, or you can have new posts sent to you by e-mail. You can also follow me on Twitter.
1 Comment »
















on 21 Oct 2008 at 9:55 pm 1.Sid said …
Thanks! I ran into this problem and was getting really frustrated about what was wrong.