table inheritance and privileges

Started by Ted Tothover 3 years ago3 messagesgeneral
Jump to latest
#1Ted Toth
txtoth@gmail.com

I'm dynamically creating tables that inherit from another table but
they don't inherit the access privileges. Is there a way to have the
new tables inherit their parent tables access privileges?

Ted

#2Tom Lane
tgl@sss.pgh.pa.us
In reply to: Ted Toth (#1)
Re: table inheritance and privileges

Ted Toth <txtoth@gmail.com> writes:

I'm dynamically creating tables that inherit from another table but
they don't inherit the access privileges. Is there a way to have the
new tables inherit their parent tables access privileges?

No, but do you need that? When accessing the parent table, there's
no need for privileges on individual children --- we only check
tables(s) directly named in the query.

regards, tom lane

#3Ted Toth
txtoth@gmail.com
In reply to: Tom Lane (#2)
Re: table inheritance and privileges

I have written a 'before insert' trigger using a similar technique to
that described in section 5.11.3 of :
https://www.postgresql.org/docs/14/ddl-partitioning.html#DDL-PARTITIONING-USING-INHERITANCE

However my trigger queries to see if the partition table exists,
creates it if it doesn't then inserts into it and returns 'SKIP'
(plpython3u).

Show quoted text

On Wed, Sep 28, 2022 at 2:49 PM Tom Lane <tgl@sss.pgh.pa.us> wrote:

Ted Toth <txtoth@gmail.com> writes:

I'm dynamically creating tables that inherit from another table but
they don't inherit the access privileges. Is there a way to have the
new tables inherit their parent tables access privileges?

No, but do you need that? When accessing the parent table, there's
no need for privileges on individual children --- we only check
tables(s) directly named in the query.

regards, tom lane