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:
    Migrating Data from Postgres 7 to 8
    PostgreSQL Using Too Much Memory
    Problems Installing the DotNetNuke StarterKit
    Fixing Database Error 1054 in Fireboard

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.


One Response 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.

Trackback This Post | Subscribe to the comments through RSS Feed

Leave a Reply