Re: how to auto GRANT rights on a new table? - Mailing list pgsql-novice

From Maciej Sieczka
Subject Re: how to auto GRANT rights on a new table?
Date
Msg-id 47C032A8.2020509@o2.pl
Whole thread Raw
In response to how to auto GRANT rights on a new table?  (Maciej Sieczka <tutey@o2.pl>)
List pgsql-novice
Obe, Regina pisze:
> I had posted this earlier to postgis group, but apparently it didn't
> go thru.

It seems so. My further posts there didn't go through either.

> I take it that you have no control over how these people are creating
>  tables.  e.g they are not creating it via some custom application of
>  yours where the solution would be obvious.

These are PostGIS tables created with QGIS Python plugin, which I could
modify to set desired ACL, if there's no other way. However, there are
also non-spatial tables created with OO.org Base, of which I don't have
that control. Moreover, other client software creating tables in future
might come to play. Thus, it would be most robust to solve the issue on
the server side, not to have to manage the software on the client side
in this regard at all.

> Unfortunately you can't put a trigger on pg_tables because that is
> not a table but a read-only view.

I see. How about a trigger on pg_class table directly? Would it be doable?

> The way I usually handle this issue is to just have a plpgsql stored
> function that gets called by some hourly process running that grants
> permissions to tables that don't already have them. e.g. using
> something like pgAgent or crontab.  Your function would look
> something like

Thank you very much for your example. I'd still prefer a solution which
sets ACL instantly when the table is created though. Really no way?

Maciek


pgsql-novice by date:

Previous
From: Raimon Fernandez
Date:
Subject: Re: Sequences, defaults and getting a new key
Next
From: "Mag Gam"
Date:
Subject: Logging Question