Thread: BUG #4337: psql -c case insensitive

BUG #4337: psql -c case insensitive

From
"none"
Date:
The following bug has been logged online:

Bug reference:      4337
Logged by:          none
Email address:      nomind@mailinator.com
PostgreSQL version: 8.2.3
Operating system:   windows xp
Description:        psql -c case insensitive
Details:

I'm programming an application that uses psql (...) -c "ALTER DATABASE
\"MyBase\" RENAME TO \"MyBase2\" and it doesn't work because it looks for a
"mybase" database name.

I'm using c# respecting case sensitive arguments, so I think the error is
with psql.

Check it ;)

Re: BUG #4337: psql -c case insensitive

From
Tom Lane
Date:
"none" <nomind@mailinator.com> writes:
> I'm programming an application that uses psql (...) -c "ALTER DATABASE
> \"MyBase\" RENAME TO \"MyBase2\" and it doesn't work because it looks for a
> "mybase" database name.

Works for me.  I speculate that your scripting language is losing the
embedded double-quotes somewhere before psql gets them.  I don't know
much about Windows scripting so it's hard to say more than that; but
an extra interpretation pass over the command string would probably
cause such a problem.

            regards, tom lane

Re: BUG #4337: psql -c case insensitive

From
Magnus Hagander
Date:
Tom Lane wrote:
> "none" <nomind@mailinator.com> writes:
>> I'm programming an application that uses psql (...) -c "ALTER DATABASE
>> \"MyBase\" RENAME TO \"MyBase2\" and it doesn't work because it looks for a
>> "mybase" database name.
>
> Works for me.  I speculate that your scripting language is losing the
> embedded double-quotes somewhere before psql gets them.  I don't know
> much about Windows scripting so it's hard to say more than that; but
> an extra interpretation pass over the command string would probably
> cause such a problem.

Most likely you're bit by the completely insane rules of quoting in the
windows commandshell. See for example the comments around it in
src/port.h in the PostgreSQL distribution.

//Magnus