Re: [HACKERS] "COPY foo FROM STDOUT" and ecpg

2013-02-27 Thread Michael Meskes
On Tue, Feb 26, 2013 at 07:24:44PM +0200, Heikki Linnakangas wrote: > >IIRC this check was added because the check for "COPY FROM STDIN" had to > >added > >anyway. Since you left that one in, the patch is fine by me, although I still > >don't see a reason for it. > > Just less code to maintain. A

Re: [HACKERS] "COPY foo FROM STDOUT" and ecpg

2013-02-26 Thread Heikki Linnakangas
On 26.02.2013 18:58, Michael Meskes wrote: On Tue, Feb 26, 2013 at 05:13:38PM +0200, Heikki Linnakangas wrote: Any particular reason for ecpg to check that, while the backend doesn't care? I think we should just remove those checks from the ecpg grammar. IIRC this check was added because the c

Re: [HACKERS] "COPY foo FROM STDOUT" and ecpg

2013-02-26 Thread Robert Haas
On Tue, Feb 26, 2013 at 11:50 AM, Heikki Linnakangas wrote: > Yeah, I'd guess that it was an oversight. But it goes back all the way to > Postgres95, so it's a bit too late to change that. I don't see why. We've plugged holes like this before and will do so again in the future, I'm sure. -- Ro

Re: [HACKERS] "COPY foo FROM STDOUT" and ecpg

2013-02-26 Thread Michael Meskes
On Tue, Feb 26, 2013 at 05:13:38PM +0200, Heikki Linnakangas wrote: > COPY foo FROM STDOUT > COPY foo TO STDIN Does this make sense? > Any particular reason for ecpg to check that, while the backend > doesn't care? I think we should just remove those checks from the > ecpg grammar. IIRC this che

Re: [HACKERS] "COPY foo FROM STDOUT" and ecpg

2013-02-26 Thread Heikki Linnakangas
On 26.02.2013 18:40, Tom Lane wrote: Heikki Linnakangas writes: On 26.02.2013 18:23, Tom Lane wrote: (I assume the backend will bounce the other cases at some post-grammar stage.) No. All four combinations of FROM/TO and STDIN/STDOUT are accepted: Huh. That seems like an odd decision. I

Re: [HACKERS] "COPY foo FROM STDOUT" and ecpg

2013-02-26 Thread Greg Stark
On Tue, Feb 26, 2013 at 4:34 PM, Heikki Linnakangas wrote: > No. All four combinations of FROM/TO and STDIN/STDOUT are accepted: ... > postgres=# copy foo to stdin; > foo > bar > postgres=# copy foo to stdout; > foo > bar Hm, so STDIN/STDOUT are just noise words and psql uses stdin for input and

Re: [HACKERS] "COPY foo FROM STDOUT" and ecpg

2013-02-26 Thread Tom Lane
Heikki Linnakangas writes: > On 26.02.2013 18:23, Tom Lane wrote: >> (I assume >> the backend will bounce the other cases at some post-grammar stage.) > No. All four combinations of FROM/TO and STDIN/STDOUT are accepted: Huh. That seems like an odd decision. If we agree that that behavior is d

Re: [HACKERS] "COPY foo FROM STDOUT" and ecpg

2013-02-26 Thread Heikki Linnakangas
On 26.02.2013 18:23, Tom Lane wrote: Heikki Linnakangas writes: While looking at Fujita Etsuro's patch to allow copy to/from a shell command, I noticed that the grammar currently allows these: COPY foo FROM STDOUT COPY foo TO STDIN In other words, STDIN and STDOUT can be used completely i

Re: [HACKERS] "COPY foo FROM STDOUT" and ecpg

2013-02-26 Thread Tom Lane
Heikki Linnakangas writes: > While looking at Fujita Etsuro's patch to allow copy to/from a shell > command, I noticed that the grammar currently allows these: > COPY foo FROM STDOUT > COPY foo TO STDIN > In other words, STDIN and STDOUT can be used completely interchangeably. > However, the e

[HACKERS] "COPY foo FROM STDOUT" and ecpg

2013-02-26 Thread Heikki Linnakangas
While looking at Fujita Etsuro's patch to allow copy to/from a shell command, I noticed that the grammar currently allows these: COPY foo FROM STDOUT COPY foo TO STDIN In other words, STDIN and STDOUT can be used completely interchangeably. However, the ecpg grammar is more strict about that: