-->

Postgres COPY TO / FROM A FILE as non superuser

2020-07-28 11:07发布

问题:

im trying to create a function that any user can call in order to copy data from/to a file... my idea is to set a function that acts as a superuser or one that is executed as "postgres" but I dont know were to start to begin with.

Can anyone point me in the right direction?

回答1:

You're looking for "SECURITY DEFINER". See docs for details http://www.postgresql.org/docs/9.3/static/sql-createfunction.html