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

Reply via email to