Re: CREATE DATABASE

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: jose <jose(at)sferacarta(dot)com>
Cc: pgsql-admin(at)postgresql(dot)org
Subject: Re: CREATE DATABASE
Date: 2003-11-10 16:10:16
Message-ID: 29166.1068480616@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-admin

jose <jose(at)sferacarta(dot)com> writes:
> PostgreSQL is not consistent in the way it uses upper/lower case to
> create databases and access it.

Folding case in unquoted names in SQL commands is required by the spec.
On the other hand, we decided some time ago that names appearing in
command-line arguments should be taken literally. Before that we tried
to make the command tools work like SQL, but that didn't work well
because the shell is going to process the arguments before we get them.

For example, suppose in SQL you do
create database "MyDb";

Now when you want to connect to it, you try
psql "MyDb"
Unfortunately the shell is going to strip those double quotes, so what
psql gets is going to look like just MyDb. If it thinks to itself
"unquoted, so fold to lower case", then you lose. People ended up
having to do things like
psql '"MyDb"'
to get to their mixed-case databases.

In short, it's inconsistent because it works better this way.

regards, tom lane

In response to

Browse pgsql-admin by date

  From Date Subject
Next Message Shane Wright 2003-11-10 16:23:26 Trying to pg_restore a 7.1.3 db into 7.3.4 - stalling at 100% CPU w/ no disk access
Previous Message Markus Bertheau 2003-11-10 15:32:32 Re: small table occupies many relpages