On Fri, 30 Aug 2019, Tom Lane wrote:
I think your problem is the line break, not the parentheses. psql knows how to count parens, but it has no concept of letting backslash commands continue across lines.
Tom, Interesting. I've adopted separating select statements by their expressions as it makes it easier for me to get it right, or fix it. However, I can put it all on a single line once I know the syntax is correct and I add the \copy() function. Thanks, Rich