From: Andrew Biagioni <andrew.biagioni@e-greek.net>
To: Hemapriya <priyam_1121@yahoo.com>
Cc: pgsql-admin@postgresql.org
Subject: Re: Database, Table Names are resulting in lowercase
Date: Thu, 24 Jun 2004 10:50:25 -0400
Message-ID: <40DAEA31.1090508@e-greek.net> (raw)
In-Reply-To: <20040624141414.77975.qmail@web21324.mail.yahoo.com>
References: <20040624141414.77975.qmail@web21324.mail.yahoo.com>
If you specify an object's name without quoting it, e.g.:
ALTER TABLE MyTable ADD COLUMN MyNewCol INT4;
then it is read as all lower case. This means, that table "mytable"
will be altered, and the new column will be called "mynewcol".
To force mixed or upper case, you quote the names, e.g.:
ALTER TABLE "MyTable" ADD COLUMN "MyNewCol" INT4;
This will alter only a table called "MyTable", and table "mytable" will
not be altered. The new column will be called "MyNewCol".
IMHO, this system allows you to have mixed/upper case if you need it,
but keeps things simpler if you don't need it by avoiding case-sensitive
confusion. You can keep your SQL code more readable by adopting
case-specific name conventions (in the above examples, the SQL keywords
are all in upper case and the names all mixed or lower case), without
worrying about the objects getting created in a jumble of different
cases (if, e.g., a previous DBA used a different case convention from
the new DBA).
In my experience the only use for true mixed-case names are when I
import a table from another database, e.g. MS SQL Server or Access; at
that time it's essential to have the quoting mechanism to ALLOW me to
specify a truly-mixed-case table or column name, since the import
mechanisms tend to preserve the true name case which in MS are often
mixed-case.
Hope this helps,
Andrew
Hemapriya wrote:
>Hi All,
>
>We have postgresql running in mac. I found whatever db
>objects i create from the sql prompt results
>in lowercase. Can anyone tell me why it is happening.?
>does postgres stores the db objects in lowercase
>internally..
>
>If i create something from the shell prompt it remains
>in the same case i used. Can anyone tell me what is
>the case limitations we have in postgres for
>db,table,column names,etc.
>
>Thanks
>Priya
>
>
>
>
>
>
>
>__________________________________
>Do you Yahoo!?
>New and Improved Yahoo! Mail - 100MB free storage!
>http://promotions.yahoo.com/new_mail
>
>---------------------------(end of broadcast)---------------------------
>TIP 4: Don't 'kill -9' the postmaster
>
>
>
>
>
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Reply to all the recipients from your mail client; the link fills in
the headers below: reply via email
Some clients, webmail especially, drop In-Reply-To and References from
a link, and the reply then starts a new thread: use the mbox below.
To: pgsql-admin@postgresql.org
Cc: andrew.biagioni@e-greek.net, priyam_1121@yahoo.com
Subject: Re: Database, Table Names are resulting in lowercase
In-Reply-To: <40DAEA31.1090508@e-greek.net>
References: <20040624141414.77975.qmail@web21324.mail.yahoo.com> <40DAEA31.1090508@e-greek.net>
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox