mirror of
https://github.com/postgres/postgres.git
synced 2025-06-27 23:21:58 +03:00
Use new errdetail_log() mechanism to provide a less klugy way of reporting
large numbers of dependencies on a role that couldn't be dropped. Per a comment from Alvaro.
This commit is contained in:
@ -6,7 +6,7 @@
|
||||
* Portions Copyright (c) 1996-2008, PostgreSQL Global Development Group
|
||||
* Portions Copyright (c) 1994, Regents of the University of California
|
||||
*
|
||||
* $PostgreSQL: pgsql/src/backend/commands/user.c,v 1.178 2008/01/01 19:45:49 momjian Exp $
|
||||
* $PostgreSQL: pgsql/src/backend/commands/user.c,v 1.179 2008/03/24 19:47:35 tgl Exp $
|
||||
*
|
||||
*-------------------------------------------------------------------------
|
||||
*/
|
||||
@ -828,6 +828,7 @@ DropRole(DropRoleStmt *stmt)
|
||||
tmp_tuple;
|
||||
ScanKeyData scankey;
|
||||
char *detail;
|
||||
char *detail_log;
|
||||
SysScanDesc sscan;
|
||||
Oid roleid;
|
||||
|
||||
@ -885,12 +886,14 @@ DropRole(DropRoleStmt *stmt)
|
||||
LockSharedObject(AuthIdRelationId, roleid, 0, AccessExclusiveLock);
|
||||
|
||||
/* Check for pg_shdepend entries depending on this role */
|
||||
if ((detail = checkSharedDependencies(AuthIdRelationId, roleid)) != NULL)
|
||||
if (checkSharedDependencies(AuthIdRelationId, roleid,
|
||||
&detail, &detail_log))
|
||||
ereport(ERROR,
|
||||
(errcode(ERRCODE_DEPENDENT_OBJECTS_STILL_EXIST),
|
||||
errmsg("role \"%s\" cannot be dropped because some objects depend on it",
|
||||
role),
|
||||
errdetail("%s", detail)));
|
||||
errdetail("%s", detail),
|
||||
errdetail_log("%s", detail_log)));
|
||||
|
||||
/*
|
||||
* Remove the role from the pg_authid table
|
||||
|
Reference in New Issue
Block a user