Home > database >  Not able to export csv file in postgresql
Not able to export csv file in postgresql

Time:12-22

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.

CodePudding user response:

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

  • Related