On Jul 18, 2010, at 12:17 PM, David Christensen wrote:
>
> On Jun 21, 2010, at 9:00 AM, Tom Lane wrote:
>
>> Robert Haas <robertmhaas@gmail.com> writes:
>>> On Sun, Jun 20, 2010 at 10:51 PM, Steve Singer <ssinger_pg@sympatico.ca> wrote:
>>>> One comment I have on the output format is that values (ie the database
>>>> name) are enclosed in double quotes but the values being quoted can contain
>>>> double quotes that are not being escaped.
>>
>> This is the same as standard practice in just about every other
>> message...
>>
>>> It seems like for user and database it might be sensible to apply
>>> PQescapeIdentifier to the value before printing it.
>>
>> I think this would actually be a remarkably bad idea in this particular
>> instance, because in the majority of cases psql does not apply
>> identifier dequoting rules to user and database names. What is printed
>> should be the same as what you'd need to give to \connect, for example.
>
>
> So I'm not quite sure how the above two paragraphs resolve? Should the user/database names be quoted or not? I have
anew version of this patch available which has incorporated the feedback to this point?
>
> As an example of the current behavior, consider:
>
> machack:machack:5432=# create database "foo""bar"
> machack-# ;
> CREATE DATABASE
>
> [Sun Jul 18 12:14:49 CDT 2010]
> machack:machack:5432=# \c foo"bar
> unterminated quoted string
> You are now connected to database "machack".
>
> [Sun Jul 18 12:14:53 CDT 2010]
> machack:machack:5432=# \c "foo"bar"
> unterminated quoted string
> You are now connected to database "machack".
>
> [Sun Jul 18 12:14:59 CDT 2010]
> machack:machack:5432=# \c "foo""bar"
> You are now connected to database "foo"bar".
>
> As you can see, the value passed to connect differs from the output in the "connected to database" string.
It's helpful when you attach said patch. This has been rebased to current HEAD.
Regards,
David
--
David Christensen
End Point Corporation
david@endpoint.com