I have a CSV file. I can, using the command below, insert the data into a database if file is on the same server as the database:
psql -h localhost -d local_mydb -U myuser -c "copy mytable (column1, column2) from '/path/to/local/file.csv' with delimiter as ','"
But the file is on a local server and the database is on another (remote) server.
If I try to do this for a remote server, using the command below:
psql -h remotehost -d remote_mydb -U myuser -c "copy mytable (column1, column2) from '/path/to/local/file.csv' with delimiter as ','"
I get a permission-denied exception.
How can I insert data from a local file into a database on a remote server, without superuser privileges?