pg.ddx.io  pgsql-docs@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Petr Lančarič <Petr.Lancaric@seznam.cz>
To: David G. Johnston <david.g.johnston@gmail.com>
Cc: pgsql-docs@postgresql.org <pgsql-docs@postgresql.org>
Subject: Re: Wrong COPY command synopsis
Date: Fri, 29 Sep 2017 16:18:34 +0200 (CEST)
Message-ID: <3Xd.ixO.2mEyX0}cFDx.1PpbOw@seznam.cz> (raw)
References: <20170927110141.28561.23998@wrigleys.postgresql.org>
	<CAKFQuwaHo1=BaWA1K0_vYGFYawc55kzN==HeGvWuJLz7C_VkdA@mail.gmail.com>
List-Unsubscribe: <mailto:majordomo@postgresql.org?body=unsub%20pgsql-docs>

Thank you for answer, it was my mistake, sorry.
Firstly, I didn't remark there is a new and an old syntax and I wrongly 
mixed both of them.




Best regards

Petr Lancaric


---------- Původní e-mail ----------
Od: David G. Johnston <david.g.johnston@gmail.com>
Komu: petr.lancaric@seznam.cz
Datum: 27. 9. 2017 18:53:17
Předmět: Re: [DOCS] Wrong COPY command synopsis 
"

On Wed, Sep 27, 2017 at 4:01 AM, <petr.lancaric@seznam.cz
(mailto:petr.lancaric@seznam.cz)> wrote:



"The following documentation comment has been logged on the website:

Page: https://www.postgresql.org/docs/9.1/static/sql-copy.html
(https://www.postgresql.org/docs/9.1/static/sql-copy.html)
Description:

Postgres psql (PostgreSQL) 9.5.4

Wrong COPY command synopsis:

1. comma is not an options separator { ...( option [, ...]  ... }
2. FORMAT is not a kewyword {... FORMAT format_name ... }


Following two commands should be valid after synopsis, but they are not:

gis=# COPY gis_entity FROM &#39;/tmp/podl_db_city.csv&#39; DELIMITER &#39;,&
#39;, FORMAT
csv;
ERROR:  syntax error at or near &quot;,&quot;
LINE 1: ..._entity FROM &#39;/tmp/podl_db_city.csv&#39; DELIMITER &#39;,&#
39;, FORMAT c...

                                           ^
 gis=# COPY gis_entity FROM &#39;/tmp/podl_db_city.csv&#39; DELIMITER &#39;,
&#39; FORMAT
csv;
ERROR:  syntax error at or near &quot;FORMAT&quot;
LINE 1: ...entity FROM &#39;/tmp/podl_db_city.csv&#39; DELIMITER &#39;,&#39;
FORMAT csv...
"



​The parentheses surrounding the options are not optional.  Personally I 
like to include the WITH.




COPY gis_entity FROM 'file.csv​' WITH ( FORMAT csv );




David J.






"

view thread (3+ messages)

Message-ID: <3Xd.ixO.2mEyX0}cFDx.1PpbOw@seznam.cz>
Permalink:  ../3Xd.ixO.2mEyX0%7DcFDx.1PpbOw@seznam.cz/
Also on:    postgresql.org/message-id/3Xd.ixO.2mEyX0}cFDx.1PpbOw@seznam.cz

 · 

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 from your mail client; the link fills in
  the headers below: reply via email
  Some clients, webmail especially, drop In-Reply-To and References from
  a link, and the reply then starts a new thread: use the mbox below.

  To: pgsql-docs@postgresql.org
  Cc: Petr.Lancaric@seznam.cz, david.g.johnston@gmail.com
  Subject: Re: Wrong COPY command synopsis
  In-Reply-To: <3Xd.ixO.2mEyX0}cFDx.1PpbOw@seznam.cz>
  References: <20170927110141.28561.23998@wrigleys.postgresql.org> <CAKFQuwaHo1=BaWA1K0_vYGFYawc55kzN==HeGvWuJLz7C_VkdA@mail.gmail.com> <3Xd.ixO.2mEyX0}cFDx.1PpbOw@seznam.cz>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox