pg.ddx.io  pgsql-general@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: hubert depesz lubaczewski <depesz@depesz.pl>
To: Robert J. Sanford, Jr. <rsanford@nolimitsystems.com>
Cc: pgsql-general@postgresql.org
Subject: Re: case sensitivity?
Date: Mon, 27 Aug 2001 05:35:57 +0200
Message-ID: <20010827053557.6d628ec7.depesz@depesz.pl> (raw)
In-Reply-To: <HOEFIONAHHKFEFENBMNOGEJGCBAA.rsanford@nolimitsystems.com>
References: <HOEFIONAHHKFEFENBMNOGEJGCBAA.rsanford@nolimitsystems.com>

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



view thread (80+ messages)  latest in thread

Message-ID: <20010827053557.6d628ec7.depesz@depesz.pl>
Permalink:  ../20010827053557.6d628ec7.depesz@depesz.pl/
Also on:    postgresql.org/message-id/20010827053557.6d628ec7.depesz@depesz.pl

 · 

reply

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 using the --to and --cc options:
  reply via email

  To: pgsql-general@postgresql.org
  Cc: depesz@depesz.pl, rsanford@nolimitsystems.com
  Subject: Re: case sensitivity?
  In-Reply-To: <20010827053557.6d628ec7.depesz@depesz.pl>

* 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