Postgres: column “field” does not exist

Posted by Johan Cyprich on 01 Oct 2008 | Tagged as: How To

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.



Tweet This Tweet This Post!

Related posts:
    Migrating Data from Postgres 7 to 8
    Calculating the Date from Exported PostgreSQL Table
    PostgreSQL Using Too Much Memory
    Fixing PostgreSQL Services With Clean Install

Share this post:

del.icio.us:Postgres: column  digg:Postgres: column  spurl:Postgres: column  wists:Postgres: column  simpy:Postgres: column  newsvine:Postgres: column  blinklist:Postgres: column  furl:Postgres: column  reddit:Postgres: column  fark:Postgres: column  blogmarks:Postgres: column  Y!:Postgres: column  smarking:Postgres: column  magnolia:Postgres: column  segnalo:Postgres: column  gifttagging:Postgres: column

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.


2 Responses to “Postgres: column “field” does not exist”

  1. 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.

  2. on 07 May 2009 at 5:45 am 2.PB said …

    Thanks, same here, solved the problem.

Trackback This Post | Subscribe to the comments through RSS Feed

Leave a Reply

CommentLuv Enabled