Hackers,
I attach a patch to implement dependencies on shared objects.
As some of you may remember, the purpose of this patch is to record
dependencies on shared objects, such as roles and tablespaces, from
regular database objects. This is done on a new shared system catalog
called pg_shdepend, so that when a backend wants to drop any shared
object, it can easily verify whether it is referenced in other database.
Since the last patch I posted, I changed the following:
- updated for roles
- added a dependency type. There are three types: PIN, same as normal
dependencies; OWNER, for roles that own objects; NORMAL, all the rest
(roles in the Acl and tablespaces).
I needed to separate the OWNER entries to support changing ownership
of objects without having to poke the whole Acl for the object.
- several bugs fixed.
This patch adds pg_shdepend to the "Catalogs" chapter in the
documentation. Also, there is a new, very naive, regression test.
Regression tests pass.
This patch creates the following files:
src/backend/catalog/pg_shdepend.c
src/include/catalog/pg_shdepend.h
src/test/regress/expected/dependency.out
src/test/regress/sql/dependency.sql
Please consider this patch for inclusion into 8.1. With this patch on,
it's finally possible to remove the WITH SYSID clause to the CREATE
USER, GROUP, ROLE commands.
I'm still owing a patch to implement a DROP OWNED command, to drop the
objects owned by a given role; and maybe a REASSIGN OWNED, to "give" the
objects to another role. Please comment on those -- I think they are
required or at least useful. Those are fairly trivial patches, and I
have half of them written already.
--
Alvaro Herrera (<alvherre[a]surnet.cl>)
"¿Qué importan los años? Lo que realmente importa es comprobar que
a fin de cuentas la mejor edad de la vida es estar vivo" (Mafalda)