Re: Directory/File Access Permissions for COPY and Generic File Access Functions - Mailing list pgsql-hackers

From Adam Brightwell
Subject Re: Directory/File Access Permissions for COPY and Generic File Access Functions
Date
Msg-id CAKRt6CS1=QriJ8Br-Wf+xE4ZBDbZW6uSUp8dWvivqOEAC7Fwnw@mail.gmail.com
Whole thread Raw
In response to Re: Directory/File Access Permissions for COPY and Generic File Access Functions  (Alvaro Herrera <alvherre@2ndquadrant.com>)
Responses Re: Directory/File Access Permissions for COPY and Generic File Access Functions
List pgsql-hackers
Alvaro,

I think it would make more sense if the file-accessing command specified
the DIRALIAS (or DIRECTORY, whatever we end up calling this) and a
pathname relative to the base one.  Something like

postgres=# CREATE DIRECTORY logdir ALIAS FOR '/pgsql/data/pg_log';

Following this, what do you think about simply expanding DIRALIAS out into to DIRECTORY ALIAS?  So instead:

CREATE DIRECTORY ALIAS <name> AS '<path>'

or...

CREATE DIRECTORY ALIAS <name> FOR '<path>'

My thought on this is towards the natural word order of the command.  Also, I think having it as CREATE DIRECTORY ALIAS minimizes confusion, as I think Stephen mentioned, that we are creating an alias, not an actual directory.  Thoughts?

postgres=# GRANT READ ON DIRECTORY logdir TO logscanner;

I personally like this form the most, however, I think the greatest hurdle with it is that it would require making READ (and WRITE) reserved keywords.  Obviously, I think that is a non-starter.
 
logscanner=> COPY logtable FROM 'postgresql-2014-10-28.csv' IN DIRECTORY logdir;

That's an interesting thought.  Would 'IN DIRECTORY' be restricted to just the alias name?  I'm not sure it would make sense to allow a directory path there, as what would be the point?  At any rate, just food for thought.

The ALTER ROLE GRANT READ idea proposed downthread is nice also,

Agreed and probably the most logical option at this point?

but one
advantage of this is not having absolute path names in the COPY command.

Pardon my ignorance, but can you help me understand the advantage of not having absolute path names in the COPY command?

-Adam 


--

pgsql-hackers by date:

Previous
From: Adam Brightwell
Date:
Subject: Re: Directory/File Access Permissions for COPY and Generic File Access Functions
Next
From: Jim Nasby
Date:
Subject: Re: Allow peer/ident to fall back to md5?