Re: COPY options

Поиск
Список
Период
Сортировка
От Andrei M. Eichler
Тема Re: COPY options
Дата
Msg-id CABS=F1+hjzqLgkx23p6RqPkyim_c2GOdMdsBZgGj27qAwwEyxw@mail.gmail.com
обсуждение исходный текст
Ответ на Re: COPY options  (Kevin Grittner <kgrittn@gmail.com>)
Ответы Re: COPY options  (Tom Lane <tgl@sss.pgh.pa.us>)
Re: COPY options  (Kevin Grittner <kgrittn@gmail.com>)
Список pgsql-docs
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 <kgrittn@gmail.com>:
On Thu, Apr 28, 2016 at 11:58 AM, Andrei M. Eichler
<andrei.eichler@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

В списке pgsql-docs по дате отправления:

Предыдущее
От: Mavka
Дата:
Сообщение: Date formatting
Следующее
От: Tom Lane
Дата:
Сообщение: Re: COPY options