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

---------------------------(end of broadcast)---------------------------
TIP 9: the planner will ignore your desire to choose an index scan if your
     joining column's datatypes do not match

Reply via email to