Case-sensitive connect in psql is perplexing

classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|

Case-sensitive connect in psql is perplexing

zorchon
I've noticed that the argument to the \c (connect) meta-command is
case-sensitive.  This doesn't seem to be consistent with other
meta-commands or the SQL standard of case-insensitive identifiers.  
Would it hurt to change the behavior?

Regards,
Kevin Murphy


--
Sent via pgsql-general mailing list ([hidden email])
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-general
Reply | Threaded
Open this post in threaded view
|

Re: Case-sensitive connect in psql is perplexing

Tom Lane-2
Kevin Murphy <[hidden email]> writes:
> I've noticed that the argument to the \c (connect) meta-command is
> case-sensitive.  This doesn't seem to be consistent with other
> meta-commands or the SQL standard of case-insensitive identifiers.  

... however, it's consistent with the behavior of psql's equivalent
command-line arguments, so you're more or less damned if you do and
damned if you don't.

I think the actual original reasoning is explained in the comment in
command.c:

     * Ideally we should treat the arguments as SQL identifiers.  But for
     * backwards compatibility with 7.2 and older pg_dump files, we have to
     * take unquoted arguments verbatim (don't downcase them). For now,
     * double-quoted arguments may be stripped of double quotes (as if SQL
     * identifiers).  By 7.4 or so, pg_dump files can be expected to
     * double-quote all mixed-case \connect arguments, and then we can get rid
     * of OT_SQLIDHACK.

which was presumbly written during the 7.3 development cycle.  We had a
shorter time horizon for compatibility considerations back then.  I'm
not sure that today, we'd want to blow off old dump files even yet...

                        regards, tom lane

--
Sent via pgsql-general mailing list ([hidden email])
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-general