Re: Database and table name case sensitivity - Mailing list pgsql-general

From Peter T Mount
Subject Re: Database and table name case sensitivity
Date
Msg-id 981707587.3a83ab439a1fa@webmail.retep.org.uk
Whole thread Raw
In response to Database and table name case sensitivity  (Ben Leslie <benno@sesgroup.net>)
Responses Re: Database and table name case sensitivity  (Ben Leslie <benno@sesgroup.net>)
List pgsql-general
Quoting Ben Leslie <benno@sesgroup.net>:

> Hi all,
>
> Just running into a few problems involving the case of table names.
>
> I am writing a program that dynamically maps python objects into
> postgres tables. These classes have mixed case names such as
> "BaseObject",
> "AbcXyzObject" etc.

> I am wondering if there is any reason that this case information is
> discarded when creating tables?

I think it's part of one of the SQL specs. Most DB's either map to lower case,
some to upper case, some keep the case but ignore it.

This happens enough that when Sun did the original JDBC spec they included
methods to check what scheme the backend actually uses...

> Is there any neat ways around it that don't involve me having to
> maintain my own
> table list?

No. Quote the names, eg:

select * from "BaseObject";
create table "BaseObject" ( ... ) ;

>
> If I patched postgres to store table names in a case sensitive way would
> it be accepted, what problems would this introduce?

It would probably blow up every app currently in existence ;-)

Peter

--
Peter Mount peter@retep.org.uk
PostgreSQL JDBC Driver: http://www.retep.org.uk/postgres/
RetepPDF PDF library for Java: http://www.retep.org.uk/pdf/

pgsql-general by date:

Previous
From: "Poul L. Christiansen"
Date:
Subject: Re: TOAST
Next
From: Ben Leslie
Date:
Subject: Re: Database and table name case sensitivity