Re: question about docs on copy command

Поиск
Список
Период
Сортировка
От Tom Lane
Тема Re: question about docs on copy command
Дата
Msg-id 1028.1567778485@sss.pgh.pa.us
обсуждение исходный текст
Ответ на question about docs on copy command  (Platon Pronko <platon7pronko@gmail.com>)
Ответы Re: question about docs on copy command
Список pgsql-novice
Platon Pronko <platon7pronko@gmail.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



В списке pgsql-novice по дате отправления:

Предыдущее
От: David Raymond
Дата:
Сообщение: RE: question about docs on copy command
Следующее
От: Platon Pronko
Дата:
Сообщение: Re: question about docs on copy command