Re: [PATCHES] Current-stream read for psql's \copy

Поиск
Список
Период
Сортировка
От Richard Huxton
Тема Re: [PATCHES] Current-stream read for psql's \copy
Дата
Msg-id 40A9D2B8.2060403@archonet.com
обсуждение исходный текст
Ответ на Re: [PATCHES] Current-stream read for psql's \copy  (Bruce Momjian <pgman@candle.pha.pa.us>)
Список pgsql-hackers
Bruce Momjian wrote:
> Also, I came upon this gem:
> 
>     $ echo '\\copy test to stdout' | psql -o /tmp/z test
>     444
>     444
>     444
>     444
>     444
> 
> Seems 'copy to stdout' also has this split idea of sending \copy output
> to a different place from other output.
> 
> I guess my big question now is why someone would use \copy stdin/stdout
> for reading input from the command stream when they can use COPY?

I think the idea was that you could have a program that does something 
like (Perl):

my $fh = open('| psql -f commands.sql');
print $fh "1\ta\n";

Where commands.sql contains the \copy.

I'm not saying that was the original intention, but someone pointed out 
you could do things that way, and I can see it might (rarely) be useful.

--   Richard Huxton  Archonet Ltd


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

Предыдущее
От: Marko Karppinen
Дата:
Сообщение: Re: Call for 7.5 feature completion
Следующее
От: Richard Huxton
Дата:
Сообщение: Re: Call for 7.5 feature completion