Re: [PATCHES] Current-stream read for psql's \copy - Mailing list pgsql-hackers

From Bruce Momjian
Subject Re: [PATCHES] Current-stream read for psql's \copy
Date
Msg-id 200402101516.i1AFGE119346@candle.pha.pa.us
Whole thread Raw
In response to Re: [PATCHES] Current-stream read for psql's \copy  (Tom Lane <tgl@sss.pgh.pa.us>)
Responses Re: [PATCHES] Current-stream read for psql's \copy  (Tom Lane <tgl@sss.pgh.pa.us>)
List pgsql-hackers
Tom Lane wrote:
> Bruce Momjian <pgman@candle.pha.pa.us> writes:
> > 'psql test </tmp/x' works fine, but 'psql -f /tmp/x test' hangs waiting
> > for input from stdin.  Why would we want STDIN to read from the terminal
> > if all commands are being read from a file with -f?
> 
> Actually, that behavior is extremely useful.  Consider
>     program-that-generates-data | psql -f somescript
> The script can issue a COPY FROM STDIN to insert the data coming through
> the pipe.
> 
> > I propose we just fix this and document it in the release notes.
> 
> I propose we not break existing applications.  If we change it the way
> you suggest, there'll be no way to do the above.

But does anyone use such a capability?  The program has to generate \.
to terminate the input, so why not have it issue the \copy too?  Seems
cleaner.

--  Bruce Momjian                        |  http://candle.pha.pa.us pgman@candle.pha.pa.us               |  (610)
359-1001+  If your life is a hard drive,     |  13 Roberts Road +  Christ can be your backup.        |  Newtown Square,
Pennsylvania19073
 


pgsql-hackers by date:

Previous
From: Tom Lane
Date:
Subject: Re: [PATCHES] Current-stream read for psql's \copy
Next
From: "Keith Bottner"
Date:
Subject: Re: MS SQL features for new version