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

2004-05-18 Thread Richard Huxton
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

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

2004-05-17 Thread Bruce Momjian
Bruce Momjian wrote: Bruce Momjian wrote: What do people want to do with the current \copy behavior for stdin? Right now if you supply a file name with queries using psql -f, the copy input is read from the terminal, not from the file. Actually, I was wrong. Right now \copy reads

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

2004-02-10 Thread Bruce Momjian
Mark Feit wrote: This patch against 7.4.1's psql and the documentation adds the option of reading rows from the current input stream (standard input, -f xxx, \i xxx) during a \copy ... from operation in psql. The details were proposed and discussed (somewhat) here:

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

2004-02-10 Thread Bruce Momjian
Tom Lane wrote: Bruce Momjian [EMAIL PROTECTED] 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

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

2004-02-10 Thread Tom Lane
Bruce Momjian [EMAIL PROTECTED] 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

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

2004-02-10 Thread Tom Lane
Bruce Momjian [EMAIL PROTECTED] writes: Tom Lane wrote: 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? What, you're going to remove a feature because you don't think it's used?

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

2004-02-10 Thread Tom Lane
Bruce Momjian [EMAIL PROTECTED] writes: I will do it by vote, not because _I_ decide it is unintuitive. And I don't have to talk _you_ into it, just a majority of developers. [shrug...] Put it to a vote if you want; I feel sure you will lose. There is another argument in favor of being able

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

2004-02-10 Thread Bruce Momjian
What do people want to do with the current \copy behavior for stdin? Right now if you supply a file name with queries using psql -f, the copy input is read from the terminal, not from the file. I propose changing that so psql reads \copy input from the file so it is consistent with COPY and is

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

2004-02-10 Thread Tom Lane
Bruce Momjian [EMAIL PROTECTED] writes: Tom Lane wrote: No it doesn't. EOF will do fine. The source program doesn't necessarily have to know anything about COPY, as long as its output is in a format COPY can cope with (eg, tab-delimited). The current behavior seems quite strange and

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

2004-02-10 Thread Bruce Momjian
Tom Lane wrote: Bruce Momjian [EMAIL PROTECTED] writes: Tom Lane wrote: No it doesn't. EOF will do fine. The source program doesn't necessarily have to know anything about COPY, as long as its output is in a format COPY can cope with (eg, tab-delimited). The current behavior seems

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

2004-02-10 Thread Bruce Momjian
Tom Lane wrote: Bruce Momjian [EMAIL PROTECTED] writes: Tom Lane wrote: 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? What, you're going to remove a feature because you

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

2004-02-10 Thread scott.marlowe
On Tue, 10 Feb 2004, Tom Lane wrote: Bruce Momjian [EMAIL PROTECTED] writes: Tom Lane wrote: No it doesn't. EOF will do fine. The source program doesn't necessarily have to know anything about COPY, as long as its output is in a format COPY can cope with (eg, tab-delimited). The

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

2004-02-10 Thread Tom Lane
Mark Feit [EMAIL PROTECTED] writes: What precipitated the patch in the first place was a need to be able to do copies in-line to populate tables with small amounts of initial data. Right, that's clearly useful. The debate at hand is about the usefulness of the other behavior. BTW, pg_dump

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

2004-02-10 Thread Andrew Sullivan
On Tue, Feb 10, 2004 at 12:33:10PM -0500, Bruce Momjian wrote: What do people want to do with the current \copy behavior for stdin? I'd like to hear more discussion of Tom's argument about security before the decision is taken. -- Andrew Sullivan ---(end of

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

2004-02-10 Thread Bruce Momjian
Andrew Sullivan wrote: On Tue, Feb 10, 2004 at 12:33:10PM -0500, Bruce Momjian wrote: What do people want to do with the current \copy behavior for stdin? I'd like to hear more discussion of Tom's argument about security before the decision is taken. Tom's point is that you can feed

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

2004-02-10 Thread Bruce Momjian
Bruce Momjian wrote: What do people want to do with the current \copy behavior for stdin? Right now if you supply a file name with queries using psql -f, the copy input is read from the terminal, not from the file. Actually, I was wrong. Right now \copy reads from psql's stdin, not always