Re: pg_dump case folding bug - Mailing list pgsql-bugs

From Tom Lane
Subject Re: pg_dump case folding bug
Date
Msg-id 27511.1100322312@sss.pgh.pa.us
Whole thread Raw
In response to pg_dump case folding bug  (Russell Smith <mr-russ@pws.com.au>)
Responses Re: pg_dump case folding bug  (Russell Smith <mr-russ@pws.com.au>)
List pgsql-bugs
Russell Smith <mr-russ@pws.com.au> writes:
> pg_dump does not fold case, and quote table and schema names correctly.

This is not a bug; it is a behavior we deliberately adopted years ago,
after unsuccessful experiments with behavior like what you propose.

The rule is that names appearing on a shell command line are taken
literally, without dequoting or case folding.  Yes, this is inconsistent
with the behavior if the same string were entered within an SQL context,
but then again the command line isn't an SQL context.

The main reason for this position is that the shell imposes its own
quoting rules that we can't avoid, and these rules are not very
compatible with the SQL identifier quoting rules.  Do you *really*
want to have to type '"Test"' when you could just write Test ?

Even more to the point, the only argument in favor of adding code to do
it like this is to try to make the shell command line context just like
the SQL context, but *you can't make it so*.  If you could make "Test"
on the command line work just like "Test" in SQL it'd be great ... but
you can't because the shell will strip the double quotes before you ever
see them.

We went around a few times on this, but eventually decided it was
unhelpful to try to emulate the SQL quoting behavior.

BTW, this behavior is consistent across all our command-line tools;
if we did want to change it it'd affect much more than just pg_dump.

            regards, tom lane

pgsql-bugs by date:

Previous
From: Russell Smith
Date:
Subject: pg_dump case folding bug
Next
From: Russell Smith
Date:
Subject: Re: pg_dump case folding bug