Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtp (Exim 4.84_2) (envelope-from ) id 1awAkR-00053x-9i for pgsql-docs@arkaria.postgresql.org; Fri, 29 Apr 2016 15:54:31 +0000 Received: from localhost ([127.0.0.1] helo=postgresql.org) by malur.postgresql.org with smtp (Exim 4.84_2) (envelope-from ) id 1awAkQ-0000du-9Z for pgsql-docs@arkaria.postgresql.org; Fri, 29 Apr 2016 15:54:30 +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 1awAk4-0000FC-2Y for pgsql-docs@postgresql.org; Fri, 29 Apr 2016 15:54:08 +0000 Received: from mail-oi0-x22d.google.com ([2607:f8b0:4003:c06::22d]) by magus.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.84_2) (envelope-from ) id 1awAjw-0001Mk-2h for pgsql-docs@postgresql.org; Fri, 29 Apr 2016 15:54:07 +0000 Received: by mail-oi0-x22d.google.com with SMTP id v145so89749377oie.0 for ; Fri, 29 Apr 2016 08:53:59 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :cc; bh=r1P4F8p5pmcY4tQVNdwaiotoH5vMyurHSgU/fMJffew=; b=ra/N9xcAldvjk07XS6wCOXJ2ifSeyfNIoghIe0raJKkK0lQIjxNYrESCEhJlDgSjwY rsxZcdKF0ehruWrW11pKXuDPU/tCymhtTSde4rEMTrKZxCTHj6gE3nx7xRUMBCKchCCV 73hSsSX5yqTVbWJyYVsjKgAxv5KSyTpUFUOHXSPCWIGLC6uwn6s1H1pfgv3gfdbGOjkT 7i9mRWr5VCoNFHeAAecz9j/DnA8RkSj4k+IoJDORuWDOrsAS5e85C41Z2hwR7CvY6l0U SyqFGCmZOP7ejpTZVAaiuePclF5Wct/AWTiOfCIRuVLu3uIEy2tL6kskq3Ztx9FdFnti GCyg== 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=r1P4F8p5pmcY4tQVNdwaiotoH5vMyurHSgU/fMJffew=; b=RVCWpszOKQi77A/hNs5n8MNhA4NuFFWTEWTPauFboR3tRbn8j572r9WISc4hl8xL/H D1BMMq046nXTLq+slLDv3Fk3X5c4rrFcDBGDl49WTL6NGneqCqoAo5W6tZhYm2un+OUl CFeAyZZGIsgX6GO1qnfIQvqrWo1hze1Wh6qvVvcXtm2MY9aY6KLKF1amQcWLzJTarl1Y 8UQtGsNX5frBETEgv73XLP95/tZxKr7hMHCdRr6/6gVX07DTP1OZ82M0O+uP1LBTrHLL LOkrP33FpoDr2nZfCHKiPtU+Rfh33xaBBQkQJl6o/sD0vEJhD+xCeq1PdLU1gBxkG4VQ TfHg== X-Gm-Message-State: AOPr4FVHH997sfUMg//RIAUZaqk8Ri11XTWTyjRICH1n+Rh5C7iMUeC02EiAOHezhMcDJWz2cyVe33oUkbFybw== MIME-Version: 1.0 X-Received: by 10.202.74.195 with SMTP id x186mr10016565oia.104.1461945237876; Fri, 29 Apr 2016 08:53:57 -0700 (PDT) Received: by 10.182.19.133 with HTTP; Fri, 29 Apr 2016 08:53:57 -0700 (PDT) In-Reply-To: References: Date: Fri, 29 Apr 2016 10:53:57 -0500 Message-ID: Subject: Re: COPY options From: Kevin Grittner To: "Andrei M. Eichler" Cc: "pgsql-docs@postgresql.org" Content-Type: text/plain; charset=UTF-8 X-Pg-Spam-Score: -1.0 (-) 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 On Fri, Apr 29, 2016 at 10:31 AM, Andrei M. Eichler 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 (pgsql-docs@postgresql.org) To make changes to your subscription: http://www.postgresql.org/mailpref/pgsql-docs