Re: question about docs on copy command

From: Platon Pronko <platon7pronko(at)gmail(dot)com>
To: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Cc: pgsql-novice(at)postgresql(dot)org
Subject: Re: question about docs on copy command
Date: 2019-09-06 14:07:02
Message-ID: 16feccbd-14d2-54fa-a06b-fdc34a62cbf0@gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-novice

Indeed, my eyes completely ignored all the punctuation or pattern characters. Thank you!

Best regards,
Platon Pronko

On 2019-09-06 17:01, Tom Lane wrote:
> Platon Pronko <platon7pronko(at)gmail(dot)com> writes:
>> I'm having a little trouble with docs of COPY command: https://www.postgresql.org/docs/11/sql-copy.html
>
>> Excerpt from synopsis:
>
>>> COPY { table_name [ ( column_name [, ...] ) ] | ( query ) }
>>> TO { 'filename' | PROGRAM 'command' | STDOUT }
>>> [ [ WITH ] ( option [, ...] ) ]
>>>
>>> where option can be one of:
>>>
>>> FORMAT format_name
>
>> This led me to beleive that the following command should be valid:
>
>> copy (select 1) to stdout with format csv;
>
> You missed the parentheses. This works:
>
> regression=# copy (select 1) to stdout with (format csv);
> 1
>
> It does require a bit of attention to tell the metacharacters (braces
> and square brackets) from the literal punctuation :-(
>
>> This command executes normally:
>> copy (select 1) to stdout with csv;
>
> IIRC, that's valid per the "old syntax" described near the end of the
> page. The new syntax uses parens.
>
> regards, tom lane
>

In response to

Browse pgsql-novice by date

  From Date Subject
Next Message jbullock 2019-09-06 19:10:45 Re: Recommended Modeling Tools?
Previous Message Tom Lane 2019-09-06 14:01:25 Re: question about docs on copy command