Okay, this is the new law:
copy x from stdin;
"stdin" is whereever the actual copy from stdin command line came from.
This is that way because "stdin" in that case does not really refer to
stdin in the classical sense but tells the backend to get the data from
the same stream the command came from (namely the network connection), and
that's what we're doing.
copy x from stdout;
The output goes to whereever select * from x would go to, in particular \o
affects this. This is purely because I said so, but I think it's
reasonable.
\copy x from stdin
The input comes from psql's stdin. (Which is correcter in this case since
it's a _frontend_ copy.)
\copy x to stdout
psql's stdout
I hope everyone's happy now. ;)
On 2000-01-12, Brook Milligan mentioned:
> But there are specifically two kinds of input involved here [*]:
>
> - input of SQL commands and such to psql
> - input of data to a COPY command
>
> To me these are conceptually very distinct (in much the same way you
> have distinguished already between various output streams; in fact,
> I'm not sure how you have matched those with the output stream from
> COPY, but it might be relevant to think about that in light of this
> discussion). Thus, to me it makes sense to say "take input from there
> and there," as long as it is clear that one "there" refers to one
> input stream and the other to the other one. For example, -f
> naturally refers to the first one above, while the STDIN naturally
> refers to the second.
--
Peter Eisentraut Sernanders väg 10:115
peter_e@gmx.net 75262 Uppsala
http://yi.org/peter-e/ Sweden