cancel
Showing results for 
Search instead for 
Did you mean: 

OSX Permissions for Server COPY to itself

SOLVED
Adventurer

OSX Permissions for Server COPY to itself

What POSIX permissions do I need to set on OSX High Sierra, somewhere,  anywhere on my computer, so that PostgreSQL will let me output csv file with the copy function (COPY ( [query] ) TO '\path' WITH CSV HEADER.  I had this working through pgAdmin 4 and had server failure (completely unrelated reasons) and the restored locations in which I was able to output the data ceased working and I cannot get them working again. 

1 ACCEPTED SOLUTION

Accepted Solutions
EDB Team Member

Re: OSX Permissions for Server COPY to itself

Hi Clayton,

 

To copy data out from a database you need write permission via group and owner of the Postgres user(Database user).

i.e. at least 330 on the output path.

 

For your 2nd point :

 

1. Are your data directory and copy output path on the same mount point? 

2. Are you able to access the mount point and view the data inside it?

3. Is there any error in pg_log related to this? If yes, can you share it with us?

 

 

3 REPLIES
EDB Team Member

Re: OSX Permissions for Server COPY to itself

Hi Clayton,

 

To copy data out from a database you need write permission via group and owner of the Postgres user(Database user).

i.e. at least 330 on the output path.

 

For your 2nd point :

 

1. Are your data directory and copy output path on the same mount point? 

2. Are you able to access the mount point and view the data inside it?

3. Is there any error in pg_log related to this? If yes, can you share it with us?

 

 

Adventurer

Re: OSX Permissions for Server COPY to itself

Thanks for your answer.  I partially solved the issue.  The problem I was having recreate what had existed before arose in part because one needs to stop and restart the database for privilege changes to take effect.  The permissions needed to be set for u=postgres, g=daemon (drwxrwxrwx) in a new downloads folder in /Library/PostgreSQL/10/Downloads is what worked, but it only worked once the db was stopped and restarted.

 

I have one place to output via "copy,"  and I have other pressing issues so I will defer setting up a more convenient location until later.  

 

Thank you for your help.

Highlighted
EDB Team Member

Re: OSX Permissions for Server COPY to itself

Hi clayton_sweeney,

 

There is no need to restart the database nor reset the database connection. Just make sure the folder to which you are exporting data using "COPY" command should have atleast 330 permission and ownership of the OS user which owns the database cluster. 

 

The permission which you have given is 777 which gives the folder global access.

Let us know if this helps.