mirror of
https://github.com/postgres/postgres.git
synced 2025-06-20 15:22:23 +03:00
Refactor the handling of the various DropStmt variants so that when multiple
objects are specified, we drop them all in a single performMultipleDeletions call. This makes the RESTRICT/CASCADE checks more relaxed: it's not counted as a cascade if one of the later objects has a dependency on an earlier one. NOTICE messages about such cases go away, too. In passing, fix the permissions check for DROP CONVERSION, which for some reason was never made role-aware, and omitted the namespace-owner exemption too. Alex Hunsaker, with further fiddling by me.
This commit is contained in:
@ -8,7 +8,7 @@
|
||||
*
|
||||
*
|
||||
* IDENTIFICATION
|
||||
* $PostgreSQL: pgsql/src/backend/commands/view.c,v 1.104 2008/01/01 19:45:49 momjian Exp $
|
||||
* $PostgreSQL: pgsql/src/backend/commands/view.c,v 1.105 2008/06/14 18:04:33 tgl Exp $
|
||||
*
|
||||
*-------------------------------------------------------------------------
|
||||
*/
|
||||
@ -16,7 +16,6 @@
|
||||
|
||||
#include "access/heapam.h"
|
||||
#include "access/xact.h"
|
||||
#include "catalog/dependency.h"
|
||||
#include "catalog/namespace.h"
|
||||
#include "commands/defrem.h"
|
||||
#include "commands/tablecmds.h"
|
||||
@ -446,26 +445,3 @@ DefineView(ViewStmt *stmt, const char *queryString)
|
||||
*/
|
||||
DefineViewRules(viewOid, viewParse, stmt->replace);
|
||||
}
|
||||
|
||||
/*
|
||||
* RemoveView
|
||||
*
|
||||
* Remove a view given its name
|
||||
*
|
||||
* We just have to drop the relation; the associated rules will be
|
||||
* cleaned up automatically.
|
||||
*/
|
||||
void
|
||||
RemoveView(const RangeVar *view, DropBehavior behavior)
|
||||
{
|
||||
Oid viewOid;
|
||||
ObjectAddress object;
|
||||
|
||||
viewOid = RangeVarGetRelid(view, false);
|
||||
|
||||
object.classId = RelationRelationId;
|
||||
object.objectId = viewOid;
|
||||
object.objectSubId = 0;
|
||||
|
||||
performDeletion(&object, behavior);
|
||||
}
|
||||
|
Reference in New Issue
Block a user