Case-sensitive connect in psql is perplexing

Started by Kevin Murphyabout 17 years ago2 messagesgeneral
Jump to latest
#1Kevin Murphy
murphy@genome.chop.edu

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

#2Tom Lane
tgl@sss.pgh.pa.us
In reply to: Kevin Murphy (#1)
Re: Case-sensitive connect in psql is perplexing

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