Thread: Shared dependencies
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"
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)
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
Gavin Sherry <swm@linuxworld.com.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