mirror of
https://github.com/postgres/postgres.git
synced 2025-11-22 12:22:45 +03:00
Track dependencies on shared objects (which is to say, roles; we already
have adequate mechanisms for tracking the contents of databases and tablespaces). This solves the longstanding problem that you can drop a user who still owns objects and/or has access permissions. Alvaro Herrera, with some kibitzing from Tom Lane.
This commit is contained in:
@@ -8,7 +8,7 @@
|
||||
*
|
||||
*
|
||||
* IDENTIFICATION
|
||||
* $PostgreSQL: pgsql/src/backend/catalog/pg_proc.c,v 1.131 2005/06/28 19:51:21 tgl Exp $
|
||||
* $PostgreSQL: pgsql/src/backend/catalog/pg_proc.c,v 1.132 2005/07/07 20:39:57 tgl Exp $
|
||||
*
|
||||
*-------------------------------------------------------------------------
|
||||
*/
|
||||
@@ -349,7 +349,10 @@ ProcedureCreate(const char *procedureName,
|
||||
* existing function, first delete any existing pg_depend entries.
|
||||
*/
|
||||
if (is_update)
|
||||
{
|
||||
deleteDependencyRecordsFor(ProcedureRelationId, retval);
|
||||
deleteSharedDependencyRecordsFor(ProcedureRelationId, retval);
|
||||
}
|
||||
|
||||
myself.classId = ProcedureRelationId;
|
||||
myself.objectId = retval;
|
||||
@@ -382,6 +385,9 @@ ProcedureCreate(const char *procedureName,
|
||||
recordDependencyOn(&myself, &referenced, DEPENDENCY_NORMAL);
|
||||
}
|
||||
|
||||
/* dependency on owner */
|
||||
recordDependencyOnOwner(ProcedureRelationId, retval, GetUserId());
|
||||
|
||||
heap_freetuple(tup);
|
||||
|
||||
heap_close(rel, RowExclusiveLock);
|
||||
|
||||
Reference in New Issue
Block a user