pg.ddx.io pgsql-admin@postgresql.org mailing list archive
help / color / mirror / Atom feedDatabase, Table Names are resulting in lowercase
3+ messages / 3 participants
[nested] [flat]
* Database, Table Names are resulting in lowercase
@ 2004-06-24 14:14 Hemapriya <priyam_1121@yahoo.com>
2004-06-24 14:50 ` Re: Database, Table Names are resulting in lowercase Andrew Biagioni <andrew.biagioni@e-greek.net>
0 siblings, 1 reply; 3+ messages in thread
From: Hemapriya @ 2004-06-24 14:14 UTC (permalink / raw)
To: pgsql-admin
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
^ permalink raw reply [nested|flat] 3+ messages in thread
* Re: Database, Table Names are resulting in lowercase
2004-06-24 14:14 Database, Table Names are resulting in lowercase Hemapriya <priyam_1121@yahoo.com>
@ 2004-06-24 14:50 ` Andrew Biagioni <andrew.biagioni@e-greek.net>
2004-06-24 15:21 ` Re: Database, Table Names are resulting in lowercase Tom Lane <tgl@sss.pgh.pa.us>
0 siblings, 1 reply; 3+ messages in thread
From: Andrew Biagioni @ 2004-06-24 14:50 UTC (permalink / raw)
To: Hemapriya <priyam_1121@yahoo.com>; +Cc: pgsql-admin
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
>
>
>
>
>
^ permalink raw reply [nested|flat] 3+ messages in thread
* Re: Database, Table Names are resulting in lowercase
2004-06-24 14:14 Database, Table Names are resulting in lowercase Hemapriya <priyam_1121@yahoo.com>
2004-06-24 14:50 ` Re: Database, Table Names are resulting in lowercase Andrew Biagioni <andrew.biagioni@e-greek.net>
@ 2004-06-24 15:21 ` Tom Lane <tgl@sss.pgh.pa.us>
0 siblings, 0 replies; 3+ messages in thread
From: Tom Lane @ 2004-06-24 15:21 UTC (permalink / raw)
To: Andrew Biagioni <andrew.biagioni@e-greek.net>; +Cc: Hemapriya <priyam_1121@yahoo.com>; pgsql-admin
Andrew Biagioni <andrew.biagioni@e-greek.net> writes:
> To force mixed or upper case, you quote the names, e.g.:
> ALTER TABLE "MyTable" ADD COLUMN "MyNewCol" INT4;
Also, the command-line tools that we have (createdb, pg_dump, etc)
generally will double-quote any SQL names that are given to them via
the shell command line. This is not completely consistent but we
settled on that behavior as the most convenient way. For awhile we
had these tools just passing command-line arguments through into SQL
as-is, so that unquoted names were effectively downcased. But then
to put in a mixed-case name you had to do something like
$ createdb '"MixedCase"'
Simply double-quoting didn't work because the shell would strip off
double quotes. That was just too ugly to work with, thus the current
behavior was arrived at.
regards, tom lane
^ permalink raw reply [nested|flat] 3+ messages in thread
end of thread, other threads:[~2004-06-24 15:21 UTC | newest]
Thread overview: 3+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2004-06-24 14:14 Database, Table Names are resulting in lowercase Hemapriya <priyam_1121@yahoo.com>
2004-06-24 14:50 ` Andrew Biagioni <andrew.biagioni@e-greek.net>
2004-06-24 15:21 ` Tom Lane <tgl@sss.pgh.pa.us>
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