Re: Re: csv format for psql

Поиск
Список
Период
Сортировка
От Daniel Verite
Тема Re: Re: csv format for psql
Дата
Msg-id f8fe5886-2150-4e9d-a9f0-682ddbcf9c61@manitou-mail.org
обсуждение исходный текст
Ответ на Re: Re: csv format for psql  (Pavel Stehule <pavel.stehule@gmail.com>)
Ответы Re: Re: csv format for psql  (Pavel Stehule <pavel.stehule@gmail.com>)
Список pgsql-hackers
    Pavel Stehule wrote:

> It should not be hard. All formats can has '|' like now, and csv can have a
> ',' - then if field separator is not explicit, then default field separator
> is used, else specified field separator is used.
>
> You can see my idea in attached patch

With that patch, consider this sequence:

postgres=# \pset format csv
Output format is csv.
postgres=# \pset fieldsep
Field separator is "|".
postgres=# select 1 as a,2 as b;
a,b
1,2

Here psql reports that fieldsep is "|" and right away is using something
else in the output. That doesn't look good.

You may object that it's fixable by tweaking the output of \pset,
\pset fieldsep, and \? variables so that it knows that the current
output format is going to use a "hidden" default separator, and
then these commands should display that value instead.
But that'd be somewhat playing whack-a-mole, as the following
sequence would now be possible, with '|' being used  as
the separator instead of the ',' reported just above:

postgres=# \pset format csv
Output format is csv.
postgres=# \pset fieldsep
Field separator is ",".
postgres=# \a
Output format is aligned.
postgres=# select 1 as a,2 as b;
 a | b
---+---
 1 | 2


Best regards,
--
Daniel Vérité
PostgreSQL-powered mailer: http://www.manitou-mail.org
Twitter: @DanielVerite


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

Предыдущее
От: Pavan Deolasee
Дата:
Сообщение: Re: [HACKERS] MERGE SQL Statement for PG11
Следующее
От: Robert Haas
Дата:
Сообщение: Re: [HACKERS] Add support for tuple routing to foreign partitions