Thread: BUG #6227: No arguments for COPY OIDS and HEADER

BUG #6227: No arguments for COPY OIDS and HEADER

From
"Itagaki Takahiro"
Date:
The following bug has been logged online:

Bug reference:      6227
Logged by:          Itagaki Takahiro
Email address:      itagaki.takahiro@gmail.com
PostgreSQL version: 9.1 and all
Operating system:   N/A
Description:        No arguments for COPY OIDS and HEADER
Details:

Our documentation says OIDS and HEADER options in COPY command take [
boolean ] arguments, but actually they don't accept any arguments. We can
only set them to TRUE by specifying their names.

http://www.postgresql.org/docs/9.1/static/sql-copy.html
- OIDS [ boolean ]
- HEADER [ boolean ]

[ <replaceable class="parameter">boolean</replaceable> ]
in copy.sgml seems a junk.

Re: BUG #6227: No arguments for COPY OIDS and HEADER

From
Tom Lane
Date:
"Itagaki Takahiro" <itagaki.takahiro@gmail.com> writes:
> Our documentation says OIDS and HEADER options in COPY command take [
> boolean ] arguments, but actually they don't accept any arguments. We can
> only set them to TRUE by specifying their names.

Um, these examples all work fine for me in HEAD:

regression=# copy tenk1 to '/dev/null' with (oids);
COPY 10000
regression=# copy tenk1 to '/dev/null' with (oids true);
COPY 10000
regression=# copy tenk1 to '/dev/null' with (oids false);
COPY 10000
regression=# copy tenk1 to '/dev/null' with (format csv, header);
COPY 10000
regression=# copy tenk1 to '/dev/null' with (format csv, header true);
COPY 10000
regression=# copy tenk1 to '/dev/null' with (format csv, header false);
COPY 10000

Also,

regression=# copy tenk1 to '/dev/null' with (oids fals);
ERROR:  oids requires a Boolean value

so it is checking the argument.

            regards, tom lane

Re: BUG #6227: No arguments for COPY OIDS and HEADER

From
Itagaki Takahiro
Date:
On Wed, Sep 28, 2011 at 11:05, Tom Lane <tgl@sss.pgh.pa.us> wrote:
> "Itagaki Takahiro" <itagaki.takahiro@gmail.com> writes:
>> Our documentation says OIDS and HEADER options in COPY command take [
>> boolean ] arguments, but actually they don't accept any arguments. We can
>> only set them to TRUE by specifying their names.
>
> Um, these examples all work fine for me in HEAD:

Ah, I was wrong.
The new COPY syntax with parentheses accepts boolean values:

OK: COPY tbl FROM '/file' WITH (OIDS true)
NG: COPY tbl FROM '/file' WITH OIDS true

So, no bugs in the docs. Sorry.

--
Itagaki Takahiro