Re: Case-sensitive connect in psql is perplexing - Mailing list pgsql-general

From Tom Lane
Subject Re: Case-sensitive connect in psql is perplexing
Date
Msg-id 616.1234324305@sss.pgh.pa.us
Whole thread Raw
In response to Case-sensitive connect in psql is perplexing  (Kevin Murphy <murphy@genome.chop.edu>)
List pgsql-general
Kevin Murphy <murphy@genome.chop.edu> 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

pgsql-general by date:

Previous
From: Kevin Murphy
Date:
Subject: Case-sensitive connect in psql is perplexing
Next
From: Pavel Stehule
Date:
Subject: Re: Referencing Cursor/Row/Record Fields in PL/PgSQL