Re: Database Name Case Sensitivity

From: Joel Burton <jburton(at)scw(dot)org>
To: "Brian T(dot) Allen" <brian(at)gzmarketing(dot)com>
Cc: Shaw Terwilliger <sterwill(at)sourcegear(dot)com>, pgsql-general(at)postgresql(dot)org
Subject: Re: Database Name Case Sensitivity
Date: 2001-04-05 19:59:09
Message-ID: Pine.LNX.4.21.0104051555220.30426-100000@olympus.scw.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general pgsql-novice

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(at)scw(dot)org>
Director of Information Systems, Support Center of Washington

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Mitch Vincent 2001-04-05 20:05:28 Re: Database Name Case Sensitivity
Previous Message Brian T. Allen 2001-04-05 19:53:40 Re: Database Name Case Sensitivity

Browse pgsql-novice by date

  From Date Subject
Next Message Mitch Vincent 2001-04-05 20:05:28 Re: Database Name Case Sensitivity
Previous Message Brian T. Allen 2001-04-05 19:53:40 Re: Database Name Case Sensitivity