Re: CREATE TABLE

From: Andrew Sullivan <ajs(at)crankycanuck(dot)ca>
To: pgsql-sql(at)postgresql(dot)org
Subject: Re: CREATE TABLE
Date: 2007-03-09 14:21:03
Message-ID: 20070309142103.GB24287@phlogiston.dyndns.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-sql

On Fri, Mar 09, 2007 at 02:56:06PM +0100, Shavonne Marietta Wijesinghe wrote:
>
> But the problem i have is that when i go and open my database in
> pgadmin the table name and coloumn name is written in lowercase :(

Unquoted identifiers in PostgreSQL are folded to lower case. This is
contrary to the SQL spec, but it normally doesn't matter because the
rule is applied consistently.

Therefore, you have two possibilities:

1. _Never_ quote identifiers. If you do it this way, everything
will always be folded to lower case, so your queries will always work
correctly.

2. _Always_ quote identifiers. This way, you always get upper
case, or mixed case, or lower case, or whatever. Indeed, you can
actually have two tables named "mytable" and "MyTable" this way, if
you were so inclined/completely mad.

The important thing to remember is that you have to pick one style,
and be absolutely certain to use it consistently. If you mix the
styles, you'll get surprises.

A
--
Andrew Sullivan | ajs(at)crankycanuck(dot)ca
The whole tendency of modern prose is away from concreteness.
--George Orwell

In response to

  • CREATE TABLE at 2007-03-09 13:56:06 from Shavonne Marietta Wijesinghe

Responses

Browse pgsql-sql by date

  From Date Subject
Next Message Andrew Sullivan 2007-03-09 14:22:10 Re: Fw: CREATE TABLE
Previous Message Shavonne Marietta Wijesinghe 2007-03-09 14:17:44 Fw: CREATE TABLE