Navdeep
Navdeep

Reputation: 863

Not able to export csv file in postgresql

I am a beginner in PostgreSQL. I have connected to postgres using

sudo -u postgres psql

Then I connected to 'test' database as 'postgres' user using the following command:

postgres=# \c test

Now when I try to export the results to home directory using the following command;

test=# \copy (select * from person left join car on person.car_id=car.id) to '/home/navdeep/Downloads/data.csv' delimiter ',' csv header;

I get the following error;

/home/navdeep/Downloads/data.csv: Permission denied

What could be the reason. Please advise. Thanks.

Upvotes: 1

Views: 547

Answers (1)

sami lekesiz
sami lekesiz

Reputation: 91

Could you try saving to the temp folder? I don't think you'll have any permission issues there.

Upvotes: 1

Related Questions