Re: [HACKERS] backslash in psql output

Поиск
Список
Период
Сортировка
От Tom Lane
Тема Re: [HACKERS] backslash in psql output
Дата
Msg-id 25962.908058970@sss.pgh.pa.us
обсуждение исходный текст
Ответ на Re: [HACKERS] backslash in psql output  (Bruce Momjian <maillist@candle.pha.pa.us>)
Список pgsql-hackers
Bruce Momjian <maillist@candle.pha.pa.us> writes:
> If the user is reading psql output into a program, it is very unclear
> how to determine a valid column delimiter vs. a delimiter in the data.

Quite true, but the PQprint output format has never been
program-friendly, as I pointed out previously.

I think the appropriate response to this gripe is to add another
command-line switch to psql, which would change its display of SELECT
data to something more suitable for program consumption, rather than
trying to make a single output format that's a bad compromise between
human readability and machine readability.

Perhaps the COPY data syntax would work for a program-friendly output
format?  (Basically tabs and newlines are field and row delimiters,
with (IIRC) backslash-escaping of tabs, newlines, backslash itself,
and maybe nulls and suchlike.  Also \N stands for a null field.)

> And what about the COPY command.  Do you want to change the display of
> escape characters there too?  I hope not.

I wasn't proposing any such thing, unless it proves necessary to ensure
we can copy arbitrary-8-bit text data out and back in.  But that's a
task for a future release.

            regards, tom lane

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

Предыдущее
От: "Oliver Elphick"
Дата:
Сообщение: Re: [HACKERS] backslash in psql output
Следующее
От: "Gene Selkov, Jr."
Дата:
Сообщение: yet another problem in recent builds, GIST this time