I have read-only access to a database on a remote server. So, I can execute:
COPY products TO '/tmp/products.csv' DELIMITER ',';
But on that server I don't have permissions to create/save a file, so I need to do this on my local machine.
When I connect to the remote database, how can I execute a command to save the file on my local machine instead of the remote server?
Or, how can I execute a Linux command to connect to the remote database, execute a query, and save the output as a file to my local machine?