I am looking for the way of creation new partitions in PostgreSQL DB from the user who doesn’t own the parent table. However, I am constantly facing “ERROR: must be owner of table” I tried such approach:
So what is the correct approach to solve my challenge.
PS. I am from Oracle world and just started discovery of PostgreSQL Permission model. So may be I am missing smth in privileges.
Create stored procedure on table owner schema
This approach should work.
grant execution on procedure to another user
That's not enough. Just doing something via a function call doesn't affect the permission checks, they're still applied to the current role. What you need for a procedure to affect permission is set the SECURITY DEFINER
option. (Check the tips for doing it properly).