Re: psql NUL record and field separator

Поиск
Список
Период
Сортировка
От Peter Eisentraut
Тема Re: psql NUL record and field separator
Дата
Msg-id 1328613643.24489.4.camel@vanquo.pezone.net
обсуждение исходный текст
Ответ на Re: psql NUL record and field separator  (Abhijit Menon-Sen <ams@toroid.org>)
Ответы Re: psql NUL record and field separator  (Abhijit Menon-Sen <ams@toroid.org>)
Список pgsql-hackers
On tor, 2012-01-26 at 19:00 +0530, Abhijit Menon-Sen wrote:
> At issue are (at least) these three lines from print_unaligned_text in
> src/bin/psql/print.c:
>
>  358         /* the last record needs to be concluded with a newline
> */
>  359         if (need_recordsep)
>  360             fputc('\n', fout);
>
> Perhaps the right thing to do would be to change this to output \0 if
> --record-separator-zero was used (but leave it at \n otherwise)? That
> is what my second attached patch does:
>
> $ bin/psql --record-separator-zero --field-separator-zero -At -c
> 'select 1,2 union select 3,4'|xargs -0 echo
> 1 2 3 4
>
> Thoughts?
>
> > I think the most common use of this would be to set the record
> > separator from the command line, so we could use a short option
> > such as -0 or -z for that.
>
> I agree. The current option names are very unwieldy to type.
>
I have incorporated your two patches and added short options.  Updated
patch attached.

This made me wonder, however.  The existing -F and -R options set the
record *separator*.  The new options, however, set the record
*terminator*.  This is the small distinction that you had discovered.

Should we rename the options and/or add that to the documentation, or is
the new behavior obvious and any new terminology would be too confusing?

Вложения

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

Предыдущее
От: Shigeru Hanada
Дата:
Сообщение: Re: Speed dblink using alternate libpq tuple storage
Следующее
От: Pavan Deolasee
Дата:
Сообщение: Re: Assertion failure in AtCleanup_Portals