Skip site navigation (1) Skip section navigation (2)

Re: how to auto GRANT rights on a new table?

From: Maciej Sieczka <tutey(at)o2(dot)pl>
To: "Obe, Regina" <robe(dot)dnd(at)cityofboston(dot)gov>
Cc: pgsql-novice(at)postgresql(dot)org
Subject: Re: how to auto GRANT rights on a new table?
Date: 2008-02-23 14:50:16
Message-ID: (view raw, whole thread or download thread mbox)
Lists: 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 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?


In response to

pgsql-novice by date

Next:From: Mag GamDate: 2008-02-24 20:57:31
Subject: Logging Question
Previous:From: Raimon FernandezDate: 2008-02-23 07:05:15
Subject: Re: Sequences, defaults and getting a new key

Privacy Policy | About PostgreSQL
Copyright © 1996-2017 The PostgreSQL Global Development Group