Postgres: column “field” does not exist

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.

5 thoughts on “Postgres: column “field” does not exist”

Leave a Comment