Hi, thanks for the wiki link.

I'm using Postgrees 9.5.2, running on Debian 8.4

I have a csv file with all columns quoted, even null values.

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';

And received this error message:

ERROR:  syntax error at or near "force_null"
LINE 1: ...test_file.csv' with csv header delimiter ';' force_null...


To fix the error, I had to replace the "_" to " ", so "force_null" becomes
"force null" :

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';

COPY 99999

In the docs (http://www.postgresql.org/docs/current/static/sql-copy.html)
the "FORCE" options are written with "_" but the correct name is with " "



2016-04-28 17:27 GMT-03:00 Kevin Grittner <kgri...@gmail.com>:

> On Thu, Apr 28, 2016 at 11:58 AM, Andrei M. Eichler
> <andrei.eich...@unicheck.com.br> wrote:
>
> > when one tries to use it as it is from the docs, one gets the following
> > results:
> > ERROR:  syntax error at or near "force_null"
>
> Works for me.
>
> Please copy/paste the actual command and the actual, complete error
> message.
>
> https://wiki.postgresql.org/wiki/Guide_to_reporting_problems
>
> --
> Kevin Grittner
> EDB: http://www.enterprisedb.com
> The Enterprise PostgreSQL Company
>

Reply via email to