Re: BUG #10925: Documentation not clear on copy options containing '_'

From: Michael Paquier <michael(dot)paquier(at)gmail(dot)com>
To: gerke(dot)ephorus(at)gmail(dot)com
Cc: pgsql-bugs(at)postgresql(dot)org
Subject: Re: BUG #10925: Documentation not clear on copy options containing '_'
Date: 2014-07-12 06:51:59
Message-ID: CAB7nPqRVGKRPr+Qdecua7y18jtxMEfBjOuPSUp+sy7FPgMiAXQ@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-bugs

On Fri, Jul 11, 2014 at 12:31 AM, <gerke(dot)ephorus(at)gmail(dot)com> wrote:
> When reading the documentation of the copy command one bumps into the
> feature 'FORCE_QUOTE'. When trying this out, the error message shown is:
> ERROR: syntax error at or near "FORCE_QUOTE"
> After fiddling with this, one finds out that it should be 'FORCE QUOTE'
> (with a space between FORCE & QUOTE)
>
> Expected situation:
> * an explanation that the '_' should be omitted
> * drop the '_' in the documentation
>
> (I'd write a patch myself but I cannot find where to change the
> documentation)
I don't see any problems with the documentation. The grammar of copy
command has changed in 9.0, making FORCE_QUOTE needing an underscore.
For backward compatibility, the old grammar has been kept as well.
Here is an example:
=# CREATE TABLE aa (a text);
CREATE TABLE
=# INSERT INTO aa VALUES ('John, Doe');
INSERT 0 1
=# insert into aa values (E'\\h');
INSERT 0 1
=# COPY aa TO stdout WITH CSV;
\h
=# COPY aa TO stdout WITH CSV FORCE_QUOTE a;
ERROR: 42601: syntax error at or near "FORCE_QUOTE"
LINE 1: COPY aa TO stdout WITH CSV FORCE_QUOTE a;
^
LOCATION: scanner_yyerror, scan.l:1053
=# COPY aa TO stdout WITH CSV FORCE QUOTE a;
"\h"
=# COPY aa TO stdout (FORMAT CSV, FORCE_QUOTE (a));
"\h"
Regards,
--
Michael

In response to

Browse pgsql-bugs by date

  From Date Subject
Next Message Rainer Tammer 2014-07-14 05:55:08 Re: Compile fails on AIX 6.1
Previous Message Michael Paquier 2014-07-12 06:14:54 Re: Missing file versions for a bunch of dll/exe files in Windows builds