Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtp (Exim 4.84_2) (envelope-from ) id 1awAOR-0004Ca-Fb for pgsql-docs@arkaria.postgresql.org; Fri, 29 Apr 2016 15:31:47 +0000 Received: from localhost ([127.0.0.1] helo=postgresql.org) by malur.postgresql.org with smtp (Exim 4.84_2) (envelope-from ) id 1awAOQ-0004tK-M6 for pgsql-docs@arkaria.postgresql.org; Fri, 29 Apr 2016 15:31:46 +0000 Received: from magus.postgresql.org ([2a02:c0:301:0:ffff::29]) by malur.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA384:256) (Exim 4.84_2) (envelope-from ) id 1awAOP-0004qh-FF for pgsql-docs@postgresql.org; Fri, 29 Apr 2016 15:31:45 +0000 Received: from mail-yw0-x22c.google.com ([2607:f8b0:4002:c05::22c]) by magus.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.84_2) (envelope-from ) id 1awAOK-0000r0-4J for pgsql-docs@postgresql.org; Fri, 29 Apr 2016 15:31:44 +0000 Received: by mail-yw0-x22c.google.com with SMTP id t10so196201950ywa.0 for ; Fri, 29 Apr 2016 08:31:39 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=unicheck-com-br.20150623.gappssmtp.com; s=20150623; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :cc; bh=VOnuq0LWdOTN2gb4bJ0S8R23C05XiLnYfzLcRpItA8k=; b=ujCP2IpZT5rQ/L/YEm+0w7ywejLYg6XDHtW/axs2hA07LHWWot5fPS5gYpRvGjORTt WEDSTxbPpJNlbTzqEULfCfjGWAyjDssIQwSq24eK7LicdGEkw4fg4rT7yoAonMjUaD6x zeoU2zNL6SucKYnVNRySyLcunJAE1q5xB/4SLU+JPf/pX8+5T+EZLkQO+zyHw+TZANCa qAYCi7KODX5zq0ZCjLc95u1v7ks0qODhodNQLoW7fVQq9vvM0evJRZwvZFlC33wdUZLf lB1gIJQEmdBkqgOSqdr/A0leHE33ABd7hM3hVcnimbw8TIJV45G8OAeRYw1CXmXwBABA XORw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:mime-version:in-reply-to:references:date :message-id:subject:from:to:cc; bh=VOnuq0LWdOTN2gb4bJ0S8R23C05XiLnYfzLcRpItA8k=; b=OhioYJ0oq8LZ3jaQQdff9q8wbswIgO3RXTyFktg03WoVBwN3lk2n4v0986PeqJVRtM m9TbBAaepeNm3A1QfbHGDJrdVPWFYi0hOZ8LBStJ0xHwKsEx22jB8bouqz6/edC3y9jz pSCmuZK2+69WrrpdkOebjuBWkQdQhpQad3doCCVi7ZSDIIGdXoPnnikp5ozUCUS4ydql w+MmtLcW7FL61ei2aFSBqMxF8zfzdCi+stYUqggKNlN02mbMjS9y319pSbPqqRXEhqLv xq7ao1gIKLymhYtyPL3Vc76jZMDILkj8G93GGwJ/mt/F0p6dA4K2gd6Ca2ssK0KvGb0G FCgg== X-Gm-Message-State: AOPr4FVwFhbpPnC5za/F3lLJLxAqJVp8gqz3g8mcLMh4kJ4mq6rwM1MrgOSwyQ0yqRXHHW4AWs67sAaZtbUsgg== MIME-Version: 1.0 X-Received: by 10.176.3.146 with SMTP id 18mr11740722uau.78.1461943897641; Fri, 29 Apr 2016 08:31:37 -0700 (PDT) Received: by 10.31.149.196 with HTTP; Fri, 29 Apr 2016 08:31:37 -0700 (PDT) X-Originating-IP: [186.222.21.23] In-Reply-To: References: Date: Fri, 29 Apr 2016 12:31:37 -0300 Message-ID: Subject: Re: COPY options From: "Andrei M. Eichler" To: Kevin Grittner Cc: "pgsql-docs@postgresql.org" Content-Type: multipart/alternative; boundary=94eb2c092ab0b36ae70531a156ce X-Pg-Spam-Score: -0.9 (/) List-Archive: List-Help: List-ID: List-Owner: List-Post: List-Subscribe: List-Unsubscribe: X-Mailing-List: pgsql-docs Precedence: bulk Sender: pgsql-docs-owner@postgresql.org --94eb2c092ab0b36ae70531a156ce Content-Type: text/plain; charset=UTF-8 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 : > On Thu, Apr 28, 2016 at 11:58 AM, Andrei M. Eichler > 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 > --94eb2c092ab0b36ae70531a156ce Content-Type: text/html; charset=UTF-8 Content-Transfer-Encoding: quoted-printable
Hi, thanks for the wiki link.

I'm u= sing 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_column= 2, date_column3, date_column4, date_column5 encoding 'latin1';
<= /div>

And received this error message:

ERROR: =C2=A0syntax error at or near "force_null"
LINE 1: ...test_file.csv' with csv header delimiter ';' force_= null...


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

COPY test_c= opy FROM '/mnt/disk1/files/test_file.csv' with csv header delimiter= ';' force null date_column, date_column2, date_column3, date_colum= n4, date_column5 encoding 'latin1';

COPY 9= 9999

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


2016-04-28 17:27 GMT-03:00 Kevin Grittner &= lt;kgrittn@gmail.com= >:
On Thu,= Apr 28, 2016 at 11:58 AM, Andrei M. Eichler
<andrei.eichler@uniche= ck.com.br> wrote:

> when one tries to use it as it is from the docs, one gets the followin= g
> results:
> ERROR:=C2=A0 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_t= o_reporting_problems

--
Kevin Grittner
EDB: http://www.enterprisedb.com
The Enterprise PostgreSQL Company

--94eb2c092ab0b36ae70531a156ce--