Thread: COPY syntax

COPY syntax

From
Peter Eisentraut
Date:
According to the syntax diagram in the documenation, I can write

COPY table TO STDOUT WITH BINARY OIDS;

Shouldn't the "binary", being an adjective, be attached to something?

-- 
Peter Eisentraut   peter_e@gmx.net



Re: COPY syntax

From
Bruce Momjian
Date:
Peter Eisentraut wrote:
> According to the syntax diagram in the documenation, I can write
> 
> COPY table TO STDOUT WITH BINARY OIDS;
> 
> Shouldn't the "binary", being an adjective, be attached to something?

Uh, it is attached to WITH?

Seriously, yea, it doesn't read well, but it follows the WITH format of
parameters to a command. 

--  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
 


Re: COPY syntax

From
Peter Eisentraut
Date:
Bruce Momjian writes:

> > According to the syntax diagram in the documenation, I can write
> >
> > COPY table TO STDOUT WITH BINARY OIDS;
> >
> > Shouldn't the "binary", being an adjective, be attached to something?
>
> Uh, it is attached to WITH?

Attached to a noun phrase, like "mode" or "output".  Note that all the
other things the typically follow WITH in any command are nouns.

-- 
Peter Eisentraut   peter_e@gmx.net



Re: COPY syntax

From
Bruce Momjian
Date:
Peter Eisentraut wrote:
> Bruce Momjian writes:
> 
> > > According to the syntax diagram in the documenation, I can write
> > >
> > > COPY table TO STDOUT WITH BINARY OIDS;
> > >
> > > Shouldn't the "binary", being an adjective, be attached to something?
> >
> > Uh, it is attached to WITH?
> 
> Attached to a noun phrase, like "mode" or "output".  Note that all the
> other things the typically follow WITH in any command are nouns.

Should we add an optional MODE after BINARY?

--  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
 


Re: COPY syntax

From
Lee Kindness
Date:
Bruce Momjian writes:> Peter Eisentraut wrote:> > Bruce Momjian writes:> > > > COPY table TO STDOUT WITH BINARY OIDS;>
>> > Shouldn't the "binary", being an adjective, be attached to something?> > > Uh, it is attached to WITH?> > Attached
toa noun phrase, like "mode" or "output".  Note that all the> > other things the typically follow WITH in any command
arenouns.> Should we add an optional MODE after BINARY?
 

Are you serious? You'd like to mess up the COPY syntax even further
for a purely grammatical reason!

A good few months ago I put formward an idea to change (well migrate
really) to "COPY TABLE" rather than "COPY" - this would allow a well
designed and thoughtout syntax for the new version while retaining old
compatibility.

egards, Lee Kindness.


Re: COPY syntax

From
Bruce Momjian
Date:
Lee Kindness wrote:
> Bruce Momjian writes:
>  > Peter Eisentraut wrote:
>  > > Bruce Momjian writes:
>  > > > > COPY table TO STDOUT WITH BINARY OIDS;
>  > > > > Shouldn't the "binary", being an adjective, be attached to something?
>  > > > Uh, it is attached to WITH?
>  > > Attached to a noun phrase, like "mode" or "output".  Note that all the
>  > > other things the typically follow WITH in any command are nouns.
>  > Should we add an optional MODE after BINARY?
> 
> Are you serious? You'd like to mess up the COPY syntax even further
> for a purely grammatical reason!
> 
> A good few months ago I put formward an idea to change (well migrate
> really) to "COPY TABLE" rather than "COPY" - this would allow a well
> designed and thoughtout syntax for the new version while retaining old
> compatibility.

I don't like the added MODE either, but Peter doesn't seem to like
BINARY alone, though it seems fine to me.

--  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
 


Re: COPY syntax

From
Peter Eisentraut
Date:
Lee Kindness writes:

> Are you serious? You'd like to mess up the COPY syntax even further
> for a purely grammatical reason!

We already "messed up" the COPY syntax in this release to achieve better
user friendliness.  I do not think it's unreasonable to review this goal
from a variety of angles.

> A good few months ago I put formward an idea to change (well migrate
> really) to "COPY TABLE" rather than "COPY" - this would allow a well
> designed and thoughtout syntax for the new version while retaining old
> compatibility.

Well, I am the first to agree that the current syntax is not well
designed, but I must admit that I don't quite see what benefit simply
adding "TABLE" would have.

-- 
Peter Eisentraut   peter_e@gmx.net



Re: COPY syntax

From
Tom Lane
Date:
Peter Eisentraut <peter_e@gmx.net> writes:
> Well, I am the first to agree that the current syntax is not well
> designed, but I must admit that I don't quite see what benefit simply
> adding "TABLE" would have.

I think the idea was that "COPY TABLE ..." could have a new clean syntax
without the warts of the current syntax.  TABLE wouldn't be a noise word,
but a trigger for a different syntax for what follows.

However, COPY's feature set is inherently pretty wart-y.  Even if we had
a green field to design syntax in, where exactly is the improvement
going to come, assuming that functionality has to stay the same?
        regards, tom lane