Re: Patch: psql \whoami option

Поиск
Список
Период
Сортировка
От David Christensen
Тема Re: Patch: psql \whoami option
Дата
Msg-id 0B812EBB-531C-45C8-8671-49E974BE0F03@endpoint.com
обсуждение исходный текст
Ответ на Re: Patch: psql \whoami option  (Tom Lane <tgl@sss.pgh.pa.us>)
Ответы Re: Patch: psql \whoami option  (David Christensen <david@endpoint.com>)
Re: Patch: psql \whoami option  (Tom Lane <tgl@sss.pgh.pa.us>)
Список pgsql-hackers
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 a
newversion 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@endpoint.com






В списке pgsql-hackers по дате отправления:

Предыдущее
От: Tom Lane
Дата:
Сообщение: Re: standard_conforming_strings
Следующее
От: "Kevin Grittner"
Дата:
Сообщение: Re: Review: Row-level Locks & SERIALIZABLE transactions, postgres vs. Oracle