pg.ddx.io  pgsql-bugs@postgresql.org mailing list archive  
help / color / mirror / Atom feed
BUG #7836: COPY command does not honor 'FORMAT' option
6+ messages / 6 participants
[nested] [flat]

* BUG #7836: COPY command does not honor 'FORMAT' option
@ 2013-01-29 18:20  kurt.lidl@cello.com
  0 siblings, 1 reply; 6+ messages in thread

From: kurt.lidl@cello.com @ 2013-01-29 18:20 UTC (permalink / raw)
  To: pgsql-bugs

The following bug has been logged on the website:

Bug reference:      7836
Logged by:          Kurt Lidl
Email address:      kurt.lidl@cello.com
PostgreSQL version: 9.2.2
Operating system:   FreeBSD 9.1 (i386 - 32bit)
Description:        

The COPY documentation says that with 9.1 (or newer), there is an option
called "FORMAT", so the user can do "FORMAT binary".  The old way just used
a keyword "binary", and this way is supported for backwards compatibility.

However, it doesn't appear that the "FORMAT" keyword works properly:

psql -U pgsql template1
psql (9.2.2)
Type "help" for help.
template1=# copy pg_aggregate to '/tmp/agg.bin' with format binary;
ERROR:  syntax error at or near "format"
LINE 1: copy pg_aggregate to '/tmp/agg.bin' with format binary;
                                                 ^
template1=# copy pg_aggregate to '/tmp/agg.bin' with binary;
COPY 120




-- 
Sent via pgsql-bugs mailing list (pgsql-bugs@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-bugs



^ permalink  raw  reply  [nested|flat] 6+ messages in thread

* Re: BUG #7836: COPY command does not honor 'FORMAT' option
@ 2013-01-29 20:19  hubert depesz lubaczewski <depesz@depesz.com>
  parent: kurt.lidl@cello.com
  0 siblings, 2 replies; 6+ messages in thread

From: hubert depesz lubaczewski @ 2013-01-29 20:19 UTC (permalink / raw)
  To: kurt.lidl@cello.com; +Cc: pgsql-bugs

On Tue, Jan 29, 2013 at 06:20:05PM +0000, kurt.lidl@cello.com wrote:
> template1=# copy pg_aggregate to '/tmp/agg.bin' with format binary;

correct syntax:

copy pg_aggregate to '/tmp/agg.bin' with (format 'binary');

Best regards,

depesz

-- 
The best thing about modern society is how easy it is to avoid contact with it.
                                                             http://depesz.com/


-- 
Sent via pgsql-bugs mailing list (pgsql-bugs@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-bugs



^ permalink  raw  reply  [nested|flat] 6+ messages in thread

* Re: BUG #7836: COPY command does not honor 'FORMAT' option
@ 2013-01-29 20:58  Kurt Lidl <kurt.lidl@cello.com>
  parent: hubert depesz lubaczewski <depesz@depesz.com>
  1 sibling, 0 replies; 6+ messages in thread

From: Kurt Lidl @ 2013-01-29 20:58 UTC (permalink / raw)
  To: depesz@depesz.com; +Cc: pgsql-bugs

On 1/29/2013 3:19 PM, hubert depesz lubaczewski wrote:
> On Tue, Jan 29, 2013 at 06:20:05PM +0000, kurt.lidl@cello.com wrote:
>> template1=# copy pg_aggregate to '/tmp/agg.bin' with format binary;
>
> correct syntax:
>
> copy pg_aggregate to '/tmp/agg.bin' with (format 'binary');
>
> Best regards,
>
> depesz
>

Oops.  Silly me.

Thanks for pointing out my missing parens.

-Kurt



-- 
Sent via pgsql-bugs mailing list (pgsql-bugs@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-bugs



^ permalink  raw  reply  [nested|flat] 6+ messages in thread

* Re: BUG #7836: COPY command does not honor 'FORMAT' option
@ 2013-01-29 21:46  Jeff Janes <jeff.janes@gmail.com>
  parent: hubert depesz lubaczewski <depesz@depesz.com>
  1 sibling, 1 reply; 6+ messages in thread

From: Jeff Janes @ 2013-01-29 21:46 UTC (permalink / raw)
  To: depesz@depesz.com; +Cc: kurt.lidl@cello.com; pgsql-bugs

On Tue, Jan 29, 2013 at 12:19 PM, hubert depesz lubaczewski
<depesz@depesz.com> wrote:
> On Tue, Jan 29, 2013 at 06:20:05PM +0000, kurt.lidl@cello.com wrote:
>> template1=# copy pg_aggregate to '/tmp/agg.bin' with format binary;
>
> correct syntax:
>
> copy pg_aggregate to '/tmp/agg.bin' with (format 'binary');

I was just about to call this confirmed before seeing your email.

I figured out the need for the parenthesis by reading the docs.  The
need to also quote 'binary' really took me by surprise, especially as
the other two formats don't need to be quoted.  I assume the reason
for this is the level of reservedness of the various words in bison.
But is this a doc bug?  Should <literal>binary</literal> be shown
quoted if it needs to be used quote?  Or at least maybe the Example
section could include an example of the use of FORMAT.


Cheers,

Jeff


-- 
Sent via pgsql-bugs mailing list (pgsql-bugs@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-bugs



^ permalink  raw  reply  [nested|flat] 6+ messages in thread

* Re: BUG #7836: COPY command does not honor 'FORMAT' option
@ 2013-01-29 22:52  Tom Lane <tgl@sss.pgh.pa.us>
  parent: Jeff Janes <jeff.janes@gmail.com>
  0 siblings, 1 reply; 6+ messages in thread

From: Tom Lane @ 2013-01-29 22:52 UTC (permalink / raw)
  To: Jeff Janes <jeff.janes@gmail.com>; +Cc: depesz@depesz.com; kurt.lidl@cello.com; pgsql-bugs

Jeff Janes <jeff.janes@gmail.com> writes:
> I figured out the need for the parenthesis by reading the docs.  The
> need to also quote 'binary' really took me by surprise, especially as
> the other two formats don't need to be quoted.  I assume the reason
> for this is the level of reservedness of the various words in bison.

Yeah, BINARY is a type_func_name_keyword and hence not covered by the
copy_generic_opt_arg production.

> But is this a doc bug?  Should <literal>binary</literal> be shown
> quoted if it needs to be used quote?  Or at least maybe the Example
> section could include an example of the use of FORMAT.

Probably better to see if we can fix the grammar instead of documenting
a klugy workaround.  I'm not sure we can easily allow fully-reserved
words there, but type_func_name_keyword might work.

			regards, tom lane


-- 
Sent via pgsql-bugs mailing list (pgsql-bugs@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-bugs



^ permalink  raw  reply  [nested|flat] 6+ messages in thread

* Re: BUG #7836: COPY command does not honor 'FORMAT' option
@ 2013-09-10 20:48  Bruce Momjian <bruce@momjian.us>
  parent: Tom Lane <tgl@sss.pgh.pa.us>
  0 siblings, 0 replies; 6+ messages in thread

From: Bruce Momjian @ 2013-09-10 20:48 UTC (permalink / raw)
  To: Tom Lane <tgl@sss.pgh.pa.us>; +Cc: Jeff Janes <jeff.janes@gmail.com>; depesz@depesz.com; kurt.lidl@cello.com; pgsql-bugs

On Tue, Jan 29, 2013 at 05:52:16PM -0500, Tom Lane wrote:
> Jeff Janes <jeff.janes@gmail.com> writes:
> > I figured out the need for the parenthesis by reading the docs.  The
> > need to also quote 'binary' really took me by surprise, especially as
> > the other two formats don't need to be quoted.  I assume the reason
> > for this is the level of reservedness of the various words in bison.
> 
> Yeah, BINARY is a type_func_name_keyword and hence not covered by the
> copy_generic_opt_arg production.
> 
> > But is this a doc bug?  Should <literal>binary</literal> be shown
> > quoted if it needs to be used quote?  Or at least maybe the Example
> > section could include an example of the use of FORMAT.
> 
> Probably better to see if we can fix the grammar instead of documenting
> a klugy workaround.  I'm not sure we can easily allow fully-reserved
> words there, but type_func_name_keyword might work.

FYI, the need for single-quotes around 'binary' was removed with a patch
and backpatched.

-- 
  Bruce Momjian  <bruce@momjian.us>        http://momjian.us
  EnterpriseDB                             http://enterprisedb.com

  + It's impossible for everything to be true. +


-- 
Sent via pgsql-bugs mailing list (pgsql-bugs@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-bugs



^ permalink  raw  reply  [nested|flat] 6+ messages in thread


end of thread, other threads:[~2013-09-10 20:48 UTC | newest]

Thread overview: 6+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2013-01-29 18:20 BUG #7836: COPY command does not honor 'FORMAT' option kurt.lidl@cello.com
2013-01-29 20:19 ` hubert depesz lubaczewski <depesz@depesz.com>
2013-01-29 20:58   ` Kurt Lidl <kurt.lidl@cello.com>
2013-01-29 21:46   ` Jeff Janes <jeff.janes@gmail.com>
2013-01-29 22:52     ` Tom Lane <tgl@sss.pgh.pa.us>
2013-09-10 20:48       ` Bruce Momjian <bruce@momjian.us>

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox