On Jun 21, 2010, at 9:00 AM, Tom Lane wrote:
> Robert Haas <robertmhaas(at)gmail(dot)com> writes:
>> On Sun, Jun 20, 2010 at 10:51 PM, Steve Singer <ssinger_pg(at)sympatico(dot)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 a new 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.
Regards,
David
--
David Christensen
End Point Corporation
david(at)endpoint(dot)com
In response to
Responses
pgsql-hackers by date
| Next: | From: Kevin Grittner | Date: 2010-07-18 17:18:06 |
| Subject: Re: Review: Row-level Locks & SERIALIZABLE transactions, postgres vs. Oracle |
| Previous: | From: Tom Lane | Date: 2010-07-18 17:16:59 |
| Subject: Re: standard_conforming_strings |