Re: " " around fields with psql

Поиск
Список
Период
Сортировка
От Merlin Moncure
Тема Re: " " around fields with psql
Дата
Msg-id CAHyXU0xoWKDyd8L8==3wtk1LXYpcbX8L8UDHtzfX47-gAx1DMg@mail.gmail.com
обсуждение исходный текст
Ответ на Re: " " around fields with psql  (Jasen Betts <jasen@xnet.co.nz>)
Ответы Re: " " around fields with psql  (Steve Clark <sclark@netwolves.com>)
Список pgsql-general
On Sat, Feb 11, 2012 at 2:03 AM, Jasen Betts <jasen@xnet.co.nz> wrote:
> On 2012-02-10, Steve Clark <sclark@netwolves.com> wrote:
>
>> Is there a way with psql to get column output to be
>> "data1","data2",...,"datan"
>
> assuming you are trying to be compatible with CSV:
>
>  copy ( your_query_here ) to stdout with csv header ;

yeah -- that's the best way if you want actual csv,  from psql you'd
probably want to do \copy:
postgres=# \copy (select 1, '"', 'ab,c') to stdout csv header;
?column?,?column?,?column?
1,"""","ab,c"

note that per csv rules columns are only required to be quoted to
protect from unambiguous parsing.  also, double quotes in your field
will be escaped.

merlin

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

Предыдущее
От: Merlin Moncure
Дата:
Сообщение: Re: easy function or trigger to UPPER() all alpha data
Следующее
От: Steve Clark
Дата:
Сообщение: Re: " " around fields with psql