Re: CREATE DATABASE - Mailing list pgsql-admin

From Tom Lane
Subject Re: CREATE DATABASE
Date
Msg-id 29166.1068480616@sss.pgh.pa.us
Whole thread Raw
In response to CREATE DATABASE  (jose <jose@sferacarta.com>)
List pgsql-admin
jose <jose@sferacarta.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

pgsql-admin by date:

Previous
From: "bagley@traderonline.com"
Date:
Subject: Re: revoke create table from a user
Next
From: ow
Date:
Subject: Vacuum verbose and entry timestamp