Re: case sensitivity? - Mailing list pgsql-general

From hubert depesz lubaczewski
Subject Re: case sensitivity?
Date
Msg-id 20010827053557.6d628ec7.depesz@depesz.pl
Whole thread Raw
In response to case sensitivity?  ("Robert J. Sanford, Jr." <rsanford@nolimitsystems.com>)
List pgsql-general
On Sun, 26 Aug 2001 16:06:14 -0500
"Robert J. Sanford, Jr." <rsanford@nolimitsystems.com> wrote:

> is there any setting that will allow postgres to
> keep mixed case column names when creating a db?

yes:
when you create table make sure all identifiers are inside quotation marks
("). like this:
create table "MyTable" (
    id SERIAL,
    "Name" TEXT,
    "Phone" TEXT,
    PRIMARY KEY (id)
);

but since then all your select's have to work with quotation mark, i.e. this
will not work:
select name from mytable;
nor will work this:
select Name from MyTable;
you have to explicity do:
select "Name" from "MyTable";

the reason is very simple. pgsql internally converts all names, identifiers
and so on to lower case. both in create statements and in select's, update's
and so on.
i hope you have it clear now.

depesz

p.s. sorry for my english

--
hubert depesz lubaczewski                          http://www.depesz.pl/
------------------------------------------------------------------------
... and the end of all our exploring  will be to arrive where we started
and know the place for the first time.                    -- T. S. Eliot

pgsql-general by date:

Previous
From: "Alex Knight"
Date:
Subject: RE: PL/java?
Next
From: speedboy
Date:
Subject: Optimizing Postgresql article phpbuilder.com.