pg.ddx.io  pgsql-docs@postgresql.org mailing list archive  
help / color / mirror / Atom feed
Wrong COPY command synopsis
3+ messages / 3 participants
[nested] [flat]

* Wrong COPY command synopsis
@ 2017-09-27 11:01  petr.lancaric@seznam.cz
  0 siblings, 1 reply; 3+ messages in thread

From: petr.lancaric@seznam.cz @ 2017-09-27 11:01 UTC (permalink / raw)
  To: pgsql-docs

The following documentation comment has been logged on the website:

Page: 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 '/tmp/podl_db_city.csv' DELIMITER ',', FORMAT
csv;
ERROR:  syntax error at or near ","
LINE 1: ..._entity FROM '/tmp/podl_db_city.csv' DELIMITER ',', FORMAT c...
                  
                                           ^
gis=# COPY gis_entity FROM '/tmp/podl_db_city.csv' DELIMITER ',' FORMAT
csv;
ERROR:  syntax error at or near "FORMAT"
LINE 1: ...entity FROM '/tmp/podl_db_city.csv' DELIMITER ',' FORMAT csv...
                                                             ^





-- 
Sent via pgsql-docs mailing list (pgsql-docs@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-docs


^ permalink  raw  reply  [nested|flat] 3+ messages in thread

* Re: Wrong COPY command synopsis
@ 2017-09-27 16:53  David G. Johnston <david.g.johnston@gmail.com>
  parent: petr.lancaric@seznam.cz
  0 siblings, 1 reply; 3+ messages in thread

From: David G. Johnston @ 2017-09-27 16:53 UTC (permalink / raw)
  To: petr.lancaric@seznam.cz; +Cc: pgsql-docs

On Wed, Sep 27, 2017 at 4:01 AM, <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
> 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.

^ permalink  raw  reply  [nested|flat] 3+ messages in thread

* Re: Wrong COPY command synopsis
@ 2017-09-29 14:18  Petr Lančarič <Petr.Lancaric@seznam.cz>
  parent: David G. Johnston <david.g.johnston@gmail.com>
  0 siblings, 0 replies; 3+ messages in thread

From: Petr Lančarič @ 2017-09-29 14:18 UTC (permalink / raw)
  To: David G. Johnston <david.g.johnston@gmail.com>; +Cc: pgsql-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.






"

^ permalink  raw  reply  [nested|flat] 3+ messages in thread


end of thread, other threads:[~2017-09-29 14:18 UTC | newest]

Thread overview: 3+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2017-09-27 11:01 Wrong COPY command synopsis petr.lancaric@seznam.cz
2017-09-27 16:53 ` David G. Johnston <david.g.johnston@gmail.com>
2017-09-29 14:18   ` Petr Lančarič <Petr.Lancaric@seznam.cz>

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