Re: [HACKERS] psql -f inconsistency with "copy from stdin"

From: Peter Eisentraut <peter_e(at)gmx(dot)net>
To: Brook Milligan <brook(at)biology(dot)nmsu(dot)edu>
Cc: pgsql-hackers(at)postgresql(dot)org
Subject: Re: [HACKERS] psql -f inconsistency with "copy from stdin"
Date: 2000-01-14 22:25:44
Message-ID: Pine.LNX.4.21.0001140134370.1917-100000@localhost.localdomain
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

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(at)gmx(dot)net 75262 Uppsala
http://yi.org/peter-e/ Sweden

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Peter Eisentraut 2000-01-14 22:26:23 pg_pwd
Previous Message Peter Eisentraut 2000-01-14 22:25:36 psql variables fixed (?)