[GENERAL] COPY vs \COPY FROM PROGRAM $$ quoting difference?

Поиск
Список
Период
Сортировка
От Alexander Stoddard
Тема [GENERAL] COPY vs \COPY FROM PROGRAM $$ quoting difference?
Дата
Msg-id CADDNc-D83E-FadbEpk4M2N3pE1WdfYdcY4ThpoQ5wVdEJsxCvA@mail.gmail.com
обсуждение исходный текст
Ответы Re: [GENERAL] COPY vs \COPY FROM PROGRAM $$ quoting difference?  ("David G. Johnston" <david.g.johnston@gmail.com>)
Список pgsql-general
I found what seems to be an odd difference between COPY and \copy parsing.

I am using a bash pipeline of sed commands to clean up a source data file before importing it into a table.  This works fine when working from the command line and piping the result to psql on STDIN. 

However I attempted to put this same workflow into a psql script (as opposed to a shell script). To avoid quoting issues with the shell pipeline I put my pipeline command string in dollar quotes.

eg.
COPY dest_table FROM PROGRAM $$ sed 's/x/y/' | etc... $$ 

To my surprise this worked with COPY but not \COPY which failed with:
\copy: parse error at "$$"

Is this an undocumented difference? Is this even the appropriate email list to ask this kind of question or report such a difference?

Thank you,
Alex Stoddard

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

Предыдущее
От: Andy Colson
Дата:
Сообщение: Re: [GENERAL] PG 10 and perl
Следующее
От: "David G. Johnston"
Дата:
Сообщение: Re: [GENERAL] COPY vs \COPY FROM PROGRAM $$ quoting difference?