Re: Escape parentheses in aggregate function

2019-08-30 Thread Rich Shepard
On Fri, 30 Aug 2019, Tom Lane wrote: FWIW, if you're running a current release then there's a reasonable alternative for writing multi-line COPY-from-query commands; see commit log below. Thanks, Tom. I'm running 11.1 and plan to upgrade to 11.5 this weekend. Regards, Rich

Re: Escape parentheses in aggregate function

2019-08-30 Thread Tom Lane
Rich Shepard writes: > 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. > Interesting. I've adopted separating select statements by

Re: Escape parentheses in aggregate function

2019-08-30 Thread Rich Shepard
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 m

Re: Escape parentheses in aggregate function

2019-08-30 Thread Tom Lane
Rich Shepard writes: > I want to copy query results to a text file and there's an aggregate > function in the SELECT expression. One of the aggregate function's > parentheses seems to end the \copy() function and I don't know how best to > write the statement. A minimal example: > \copy(select co

Escape parentheses in aggregate function

2019-08-30 Thread Rich Shepard
I want to copy query results to a text file and there's an aggregate function in the SELECT expression. One of the aggregate function's parentheses seems to end the \copy() function and I don't know how best to write the statement. A minimal example: \copy(select count_value, sum(count_value) fro