Re: Combining \i and \copy in psql

2018-05-15 Thread David G. Johnston
On Tue, May 15, 2018 at 8:30 AM, Rhys A.D. Stewart wrote: > Greetings, > > I have a query in a .sql file and I'd like to use \i to execute it and > \copy to save it to a csv file. Is there any way to combine the two? > > Something along the lines of: > > \copy \i myquery.sql to 'output.csv' > ​M

Combining \i and \copy in psql

2018-05-15 Thread Rhys A.D. Stewart
Greetings, I have a query in a .sql file and I'd like to use \i to execute it and \copy to save it to a csv file. Is there any way to combine the two? Something along the lines of: \copy \i myquery.sql to 'output.csv' Rhys Peace & Love|Live Long & Prosper