Re: [SQL] id and ID in CREATE TABLE - Mailing list pgsql-general

From Christopher Kings-Lynne
Subject Re: [SQL] id and ID in CREATE TABLE
Date
Msg-id GNELIHDDFBOCMGBFGEFOMEDKCDAA.chriskl@familyhealth.com.au
Whole thread Raw
In response to id and ID in CREATE TABLE  (stefan@extum.com)
List pgsql-general
> Can somebody explain me a bit about:
>
> 1. As far as I know column names in Tables are not case
> sensitive. Correct ?
> So I know if I pickup ID is not a clever idea but for this
> example it is ok.

I think your examples have proved that column names are in fact very much
case sensitive.  However, you will need to double quote mixed case names:

eg. SELECT "ID" FROM ttt2;

> As well if I have name and Name it should not matter for SQL.

Well it does in Postgresql.  I highly recommend you just use lowercase field
names.

> 2. Why psql converts from upper case in lower case column name ID ?
> Like in the first case.

Because you didn't double quote it.

> 3. How comes that first using psql I cannot create the column name ID but
> using pgaccess I can ?  Is this a bug ?

Because pgaccess is doing the double quoting for you.

Chris


pgsql-general by date:

Previous
From: "Christian Lübeck"
Date:
Subject: References for PostgreSQL
Next
From: Steve Brett
Date:
Subject: Re: References for PostgreSQL