pg.ddx.io pgsql-admin@postgresql.org mailing list archive
help / color / mirror / Atom feedCREATE DATABASE
3+ messages / 3 participants
[nested] [flat]
* CREATE DATABASE
@ 2003-11-10 10:32 jose <jose@sferacarta.com>
2003-11-10 16:10 ` Re: CREATE DATABASE Tom Lane <tgl@sss.pgh.pa.us>
2003-11-10 17:15 ` Re: CREATE DATABASE Peter Eisentraut <peter_e@gmx.net>
0 siblings, 2 replies; 3+ messages in thread
From: jose @ 2003-11-10 10:32 UTC (permalink / raw)
To: pgsql-admin
Hi,
PostgreSQL is not consistent in the way it uses upper/lower case to
create databases and access it.
Why psql -c 'CREATE DATABASE name_db' uses lower(name_db) an less the
name is enclosed by "" but psql name_db ?
Take a look ....
psql template1 -c "create database MYDB"
psql MYDB
psql: FATAL 1: Database "MYDB" does not exist in the system catalog.
Jo
^ permalink raw reply [nested|flat] 3+ messages in thread
* Re: CREATE DATABASE
2003-11-10 10:32 CREATE DATABASE jose <jose@sferacarta.com>
@ 2003-11-10 16:10 ` Tom Lane <tgl@sss.pgh.pa.us>
1 sibling, 0 replies; 3+ messages in thread
From: Tom Lane @ 2003-11-10 16:10 UTC (permalink / raw)
To: jose <jose@sferacarta.com>; +Cc: 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
^ permalink raw reply [nested|flat] 3+ messages in thread
* Re: CREATE DATABASE
2003-11-10 10:32 CREATE DATABASE jose <jose@sferacarta.com>
@ 2003-11-10 17:15 ` Peter Eisentraut <peter_e@gmx.net>
1 sibling, 0 replies; 3+ messages in thread
From: Peter Eisentraut @ 2003-11-10 17:15 UTC (permalink / raw)
To: jose <jose@sferacarta.com>; +Cc: pgsql-admin
jose writes:
> PostgreSQL is not consistent in the way it uses upper/lower case to
> create databases and access it.
> Why psql -c 'CREATE DATABASE name_db' uses lower(name_db) an less the
> name is enclosed by "" but psql name_db ?
These are two different language bindings for the same functionality.
You could also claim that Unix is not consistent because C programs and
shell scripts provide different ways to do the same thing. You would be
right, but it's nevertheless quite intended that way.
--
Peter Eisentraut peter_e@gmx.net
^ permalink raw reply [nested|flat] 3+ messages in thread
end of thread, other threads:[~2003-11-10 17:15 UTC | newest]
Thread overview: 3+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2003-11-10 10:32 CREATE DATABASE jose <jose@sferacarta.com>
2003-11-10 16:10 ` Tom Lane <tgl@sss.pgh.pa.us>
2003-11-10 17:15 ` Peter Eisentraut <peter_e@gmx.net>
This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox