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 Responses to Postgres: column “field” does not exist

  1. Sid says:

    Thanks! I ran into this problem and was getting really frustrated about what was wrong.

  2. PB says:

    Thanks, same here, solved the problem.

  3. Yelinna says:

    Works perfectly, You saved me!!!

  4. Luis says:

    Thanks… works as I expected…

  5. jo says:

    It didnt still work

Leave a Reply

Your email address will not be published. Required fields are marked *