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

From: Richard Huxton <dev(at)archonet(dot)com>
To: Bruce Momjian <pgman(at)candle(dot)pha(dot)pa(dot)us>
Cc: PostgreSQL-development <pgsql-hackers(at)postgresql(dot)org>, Mark Feit <mfeit+postgresql(at)notonthe(dot)net>
Subject: Re: [PATCHES] Current-stream read for psql's \copy
Date: 2004-05-18 09:09:12
Message-ID: 40A9D2B8.2060403@archonet.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers pgsql-patches

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

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Richard Huxton 2004-05-18 09:20:23 Re: Call for 7.5 feature completion
Previous Message Marko Karppinen 2004-05-18 08:43:21 Re: Call for 7.5 feature completion

Browse pgsql-patches by date

  From Date Subject
Next Message Fabien COELHO 2004-05-18 10:44:21 add build utilities in default install
Previous Message Fabien COELHO 2004-05-18 08:03:12 Re: new aggregate functions v1