mirror of
https://github.com/postgres/postgres.git
synced 2025-07-27 12:41:57 +03:00
Implement DROP OWNED and REASSIGN OWNED. These new commands facilitate the
process of dropping roles by dropping objects owned by them and privileges granted to them, or giving the owned objects to someone else, through the use of the data stored in the new pg_shdepend catalog. Some refactoring of the GRANT/REVOKE code was needed, as well as ALTER OWNER code. Further cleanup of code duplication in the GRANT code seems necessary. Implemented by me after an idea from Tom Lane, who also provided various kind of implementation advice. Regression tests pass. Some tests for the new functionality are also added, as well as rudimentary documentation.
This commit is contained in:
@ -10,7 +10,7 @@
|
||||
*
|
||||
*
|
||||
* IDENTIFICATION
|
||||
* $PostgreSQL: pgsql/src/backend/tcop/utility.c,v 1.246 2005/11/19 17:39:45 adunstan Exp $
|
||||
* $PostgreSQL: pgsql/src/backend/tcop/utility.c,v 1.247 2005/11/21 12:49:32 alvherre Exp $
|
||||
*
|
||||
*-------------------------------------------------------------------------
|
||||
*/
|
||||
@ -347,6 +347,8 @@ check_xact_readonly(Node *parsetree)
|
||||
case T_GrantStmt:
|
||||
case T_GrantRoleStmt:
|
||||
case T_TruncateStmt:
|
||||
case T_DropOwnedStmt:
|
||||
case T_ReassignOwnedStmt:
|
||||
ereport(ERROR,
|
||||
(errcode(ERRCODE_READ_ONLY_SQL_TRANSACTION),
|
||||
errmsg("transaction is read-only")));
|
||||
@ -725,8 +727,7 @@ ProcessUtility(Node *parsetree,
|
||||
break;
|
||||
|
||||
/*
|
||||
* ******************************** object creation / destruction ********************************
|
||||
*
|
||||
* **************** object creation / destruction ******************
|
||||
*/
|
||||
case T_DefineStmt:
|
||||
{
|
||||
@ -1019,6 +1020,14 @@ ProcessUtility(Node *parsetree,
|
||||
DropRole((DropRoleStmt *) parsetree);
|
||||
break;
|
||||
|
||||
case T_DropOwnedStmt:
|
||||
DropOwnedObjects((DropOwnedStmt *) parsetree);
|
||||
break;
|
||||
|
||||
case T_ReassignOwnedStmt:
|
||||
ReassignOwnedObjects((ReassignOwnedStmt *) parsetree);
|
||||
break;
|
||||
|
||||
case T_LockStmt:
|
||||
LockTableCommand((LockStmt *) parsetree);
|
||||
break;
|
||||
@ -1677,6 +1686,14 @@ CreateCommandTag(Node *parsetree)
|
||||
tag = "DROP ROLE";
|
||||
break;
|
||||
|
||||
case T_DropOwnedStmt:
|
||||
tag = "DROP OWNED";
|
||||
break;
|
||||
|
||||
case T_ReassignOwnedStmt:
|
||||
tag = "REASSIGN OWNED";
|
||||
break;
|
||||
|
||||
case T_LockStmt:
|
||||
tag = "LOCK TABLE";
|
||||
break;
|
||||
|
Reference in New Issue
Block a user