Hello, I'd like to suggest the following small patch (attached), to give explicit example for COPY of new-vs-old syntax at the top of the page. === Starting with PostgreSQL version 9.0, the COPY commands supports new syntax with parenthesis and commas. The old syntax is still supported, see details at the bottom of this page.
New syntax: COPY country TO STDOUT (FORMAT CSV, NULL 'NA', HEADER ON); Old syntax: COPY country TO STDOUT NULL 'NA' CSV HEADER; === The web is full of examples, but many of them are for the old syntax. The COPY documentation page mentions this critical difference only in passing, and requires careful reading of the entire page to spot the culprit of syntax errors. A typical example is: https://www.postgresql.org/message-id/26320.1291391510%40sss.pgh.pa.us I know examples usually go at the end of the page, but I think in this case, a short example is worth at least 100 words :) Comments (and rephrasing) are welcomed, regards, - assaf This electronic message is intended for the use of the named recipient only, and may contain information that is confidential, privileged or protected from disclosure under applicable law. If you are not the intended recipient, or an employee or agent responsible for delivering this message to the intended recipient, you are hereby notified that any reading, disclosure, dissemination, distribution, copying or use of the contents of this message including any of its attachments is strictly prohibited. If you have received this message in error or are not the named recipient, please notify us immediately by contacting the sender at the electronic mail address noted above, and destroy all copies of this message. Please note, the recipient should check this email and any attachments for the presence of viruses. The organization accepts no liability for any damage caused by any virus transmitted by this email.
>From 9e96fa409f857e6e6649c7f201f9a802a87b70d3 Mon Sep 17 00:00:00 2001 From: Assaf Gordon <assafgor...@gmail.com> Date: Thu, 29 Sep 2016 11:06:35 -0400 Subject: [PATCH] Add new-vs-old COPY syntax example in documentation --- doc/src/sgml/ref/copy.sgml | 25 +++++++++++++++++++++++++ 1 file changed, 25 insertions(+) diff --git a/doc/src/sgml/ref/copy.sgml b/doc/src/sgml/ref/copy.sgml index 07e2f45..531009b 100644 --- a/doc/src/sgml/ref/copy.sgml +++ b/doc/src/sgml/ref/copy.sgml @@ -86,6 +86,31 @@ COPY { <replaceable class="parameter">table_name</replaceable> [ ( <replaceable </refsect1> <refsect1> + <title>New versus old syntax</title> + <para> + Starting with <productname>PostgreSQL</> version 9.0, the + <command>COPY</command> commands supports new syntax with parenthesis + and commas. The old syntax is still supported, see details + at the bottom of this page. + </para> + + <para> + New syntax: +<programlisting> +COPY country TO STDOUT (FORMAT CSV, NULL 'NA', HEADER ON); +</programlisting> + </para> + + <para> + Old syntax: +<programlisting> +COPY country TO STDOUT NULL 'NA' CSV HEADER; +</programlisting> + </para> + + </refsect1> + + <refsect1> <title>Parameters</title> <variablelist> -- 2.8.2
-- Sent via pgsql-docs mailing list (pgsql-docs@postgresql.org) To make changes to your subscription: http://www.postgresql.org/mailpref/pgsql-docs