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