Re: case sensitivity?

From: hubert depesz lubaczewski <depesz(at)depesz(dot)pl>
To: "Robert J(dot) Sanford, Jr(dot)" <rsanford(at)nolimitsystems(dot)com>
Cc: pgsql-general(at)postgresql(dot)org
Subject: Re: case sensitivity?
Date: 2001-08-27 03:35:57
Message-ID: 20010827053557.6d628ec7.depesz@depesz.pl
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

On Sun, 26 Aug 2001 16:06:14 -0500
"Robert J. Sanford, Jr." <rsanford(at)nolimitsystems(dot)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

In response to

Browse pgsql-general by date

  From Date Subject
Next Message speedboy 2001-08-27 04:21:18 Optimizing Postgresql article phpbuilder.com.
Previous Message Alex Knight 2001-08-27 00:22:38 RE: PL/java?