public inbox for [email protected]
help / color / mirror / Atom feedFrom: Kevin Grittner <[email protected]>
To: Andrei M. Eichler <[email protected]>
Cc: [email protected] <[email protected]>
Subject: Re: COPY options
Date: Fri, 29 Apr 2016 10:53:57 -0500
Message-ID: <CACjxUsMcsVT3N_znoWem2BtFvHtKtnNFKcJauVT4krtpjujgAw@mail.gmail.com> (raw)
In-Reply-To: <CABS=F1+hjzqLgkx23p6RqPkyim_c2GOdMdsBZgGj27qAwwEyxw@mail.gmail.com>
References: <CABS=F1+aHKpE9Z2CwnffwCOxRKn9pFuYBsoAkHCL82YLm2q3eg@mail.gmail.com>
<CACjxUsM_4O40y_bMjh3UAMmY1q3dTqecJzqRBJFzp-wkZcYCGg@mail.gmail.com>
<CABS=F1+hjzqLgkx23p6RqPkyim_c2GOdMdsBZgGj27qAwwEyxw@mail.gmail.com>
List-Unsubscribe: <mailto:[email protected]?body=unsub%20pgsql-docs>
On Fri, Apr 29, 2016 at 10:31 AM, Andrei M. Eichler
<[email protected]> wrote:
> Following the documentation, I wrote this COPY FROM command:
>
> COPY test_copy FROM '/mnt/disk1/files/test_file.csv' with csv header
> delimiter ';' force_null date_column, date_column2, date_column3,
> date_column4, date_column5 encoding 'latin1';
The syntax synopsis in the current docs requires parentheses around
any options. I was a little surprised that you got it to work at
all without them; but then remembered there is older (deprecated
and undocumented) syntax that was not ripped out to avoid breaking
code which was working before the syntax change in 9.0. To do this
per the current documentation (which I would strongly recommend
over the old, undocumented, deprecated syntax), try this:
COPY test_copy FROM '/mnt/disk1/files/test_file.csv' with (
format csv,
header true,
delimiter ';',
force_null (date_column, date_column2, date_column3, date_column4,
date_column5),
encoding 'latin1'
);
This new syntax was adopted to make it easier to add new options,
and to avoid having to define new keywords or reserved words to do
so.
It's not really a question of whether we should go back to
documenting the deprecated syntax, but whether (and when) support
for it should finally be ripped out. It was last documented in 8.4.
--
Kevin Grittner
EDB: http://www.enterprisedb.com
The Enterprise PostgreSQL Company
--
Sent via pgsql-docs mailing list ([email protected])
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-docs
view thread (7+ messages) latest in thread
reply
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Reply to all the recipients using the --to and --cc options:
reply via email
To: [email protected]
Cc: [email protected], [email protected]
Subject: Re: COPY options
In-Reply-To: <CACjxUsMcsVT3N_znoWem2BtFvHtKtnNFKcJauVT4krtpjujgAw@mail.gmail.com>
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
This inbox is served by agora; see mirroring instructions
for how to clone and mirror all data and code used for this inbox