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