Shared dependencies

Lists: pgsql-hackers
From: Alvaro Herrera <alvherre(at)dcc(dot)uchile(dot)cl>
To: Hackers <pgsql-hackers(at)postgresql(dot)org>
Subject: Shared dependencies
Date: 2004-10-28 04:30:31
Message-ID: 20041028043031.GA9767@dcc.uchile.cl
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-hackers

Hackers,

I'm currently playing with implementing a "shared dependency" catalog,
to keep track of objects pointing to global objects, currently users and
tablespaces. So it is forbidden to drop a user that owns tables (or
whatever objects) on other databases.

So far, it works nicely; it lists objects that depend on whatever user/
tablespace one is deleting and then aborts the deletion. Changing the
owner or tablespace of an object works as expected.

To this end, I have created a pg_sdepend shared catalog, very similar to
pg_depend. Both users and tablespaces are kept track of there. That
poses a problem, because users are identified internally using an AclId,
while tablespaces use an Oid. Most likely those should not be put on
the same column; it works now, but it can break at any time.

So the first obvious question: should I create two separate catalogs,
one for users and other for tablespaces?

The other obvious question is whether we should keep track of only owner
of objects, or also users that happen to be listed in their Acl. It
would be good to have all the info, but I wonder this won't make the
catalog too bloated.

(The other global objects are currently databases and groups, which
don't have objects depend on them, so there's nothing to record. If and
when someone implements SQL roles, there may be something to consider
here. Of course, if it's decided that's a good idea to record Acls,
then groups will have to be included too.)

Comments, opinions and ideas are welcome.

--
Alvaro Herrera (<alvherre[a]dcc.uchile.cl>)
"El día que dejes de cambiar dejarás de vivir"


From: Alvaro Herrera <alvherre(at)dcc(dot)uchile(dot)cl>
To: Hackers <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: Shared dependencies
Date: 2004-10-29 00:02:53
Message-ID: 20041029000253.GA15970@surnet.cl
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-hackers

On Thu, Oct 28, 2004 at 01:30:31AM -0300, Alvaro Herrera wrote:

Hi,

> So the first obvious question: should I create two separate catalogs,
> one for users and other for tablespaces?

Ok, so no opinions? Nobody objects to me creating two new shared
catalogs to keep track of dependency on global objects, one for
user/groups and other for tablespaces?

--
Alvaro Herrera (<alvherre[a]dcc.uchile.cl>)
Bob [Floyd] used to say that he was planning to get a Ph.D. by the "green
stamp method," namely by saving envelopes addressed to him as 'Dr. Floyd'.
After collecting 500 such letters, he mused, a university somewhere in
Arizona would probably grant him a degree. (Don Knuth)


From: Gavin Sherry <swm(at)linuxworld(dot)com(dot)au>
To: Alvaro Herrera <alvherre(at)dcc(dot)uchile(dot)cl>
Cc: Hackers <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: Shared dependencies
Date: 2004-10-29 00:31:29
Message-ID: Pine.LNX.4.58.0410291030140.8724@linuxworld.com.au
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-hackers

On Thu, 28 Oct 2004, Alvaro Herrera wrote:

> On Thu, Oct 28, 2004 at 01:30:31AM -0300, Alvaro Herrera wrote:
>
> Hi,
>
> > So the first obvious question: should I create two separate catalogs,
> > one for users and other for tablespaces?
>
> Ok, so no opinions? Nobody objects to me creating two new shared
> catalogs to keep track of dependency on global objects, one for
> user/groups and other for tablespaces?

Perhaps we could (gulp) reenable OIDs on pg_shadow and pg_group and then
we could just identify by OID.

Gavin


From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: Gavin Sherry <swm(at)linuxworld(dot)com(dot)au>
Cc: Alvaro Herrera <alvherre(at)dcc(dot)uchile(dot)cl>, Hackers <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: Shared dependencies
Date: 2004-10-29 03:41:28
Message-ID: 10613.1099021288@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-hackers

Gavin Sherry <swm(at)linuxworld(dot)com(dot)au> writes:
> On Thu, 28 Oct 2004, Alvaro Herrera wrote:
>> Ok, so no opinions? Nobody objects to me creating two new shared
>> catalogs to keep track of dependency on global objects, one for
>> user/groups and other for tablespaces?

> Perhaps we could (gulp) reenable OIDs on pg_shadow and pg_group and then
> we could just identify by OID.

Or better, just equate AclId with OID. It's silly to create two tables
where one will do.

regards, tom lane