Re: Database Name Case Sensitivity - Mailing list pgsql-general

From Joel Burton
Subject Re: Database Name Case Sensitivity
Date
Msg-id Pine.LNX.4.21.0104051555220.30426-100000@olympus.scw.org
Whole thread Raw
In response to Re: Database Name Case Sensitivity  ("Brian T. Allen" <brian@gzmarketing.com>)
List pgsql-general
On Thu, 5 Apr 2001, Brian T. Allen wrote:

> I just ran into that too, and find it most undesirable.  I don't know
> whether that is part of the SQL spec or not, but it seems very odd.  The
> queries seem to be converted to lowercase before they ever reach the SQL
> engine.

Everything is postgresql is lowercased, unless system identifiers (double
quotes) are wrapped around it.

  CREATE DATABASE foo

is the same as

  CREATE DATABASE FOO

or

  CREATE DATABASE Foo


You must connect to it with

  \c foo


However, if you

  CREATE TABLE "FOO"

then it is not lowercased. You must connect as

  \c FOO


I think this is a Good Thing. It allows most people to have
case-insensitive system identifiers (at least they appear
case-insensitive, since it lowercases everything). This plays well with
other database systems. If you want case-sensitive identifiers, you just
wrap them wiuth the double quotes.

(cf to the mess in MySQL, where some things are case-sensitive, and some
things aren't, and it varies based on whether the server OS is case
sensitive. Ick.)

--
Joel Burton   <jburton@scw.org>
Director of Information Systems, Support Center of Washington


pgsql-general by date:

Previous
From: "Brian T. Allen"
Date:
Subject: Re: Database Name Case Sensitivity
Next
From: "Mitch Vincent"
Date:
Subject: Re: Database Name Case Sensitivity