diff options
| author | Tom Lane | 2008-06-14 18:04:34 +0000 |
|---|---|---|
| committer | Tom Lane | 2008-06-14 18:04:34 +0000 |
| commit | 0cefb50f3ce964d6097aad64dabd9b544c3d2e68 (patch) | |
| tree | 4e1ee9454bc958d35194062eee8894205cd08da5 /src/include | |
| parent | 95ce4ee943f226152ac8c147da178af5d1a95909 (diff) | |
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.
Diffstat (limited to 'src/include')
| -rw-r--r-- | src/include/catalog/pg_conversion_fn.h | 5 | ||||
| -rw-r--r-- | src/include/commands/conversioncmds.h | 5 | ||||
| -rw-r--r-- | src/include/commands/defrem.h | 15 | ||||
| -rw-r--r-- | src/include/commands/schemacmds.h | 4 | ||||
| -rw-r--r-- | src/include/commands/tablecmds.h | 4 | ||||
| -rw-r--r-- | src/include/commands/typecmds.h | 5 | ||||
| -rw-r--r-- | src/include/commands/view.h | 3 |
7 files changed, 15 insertions, 26 deletions
diff --git a/src/include/catalog/pg_conversion_fn.h b/src/include/catalog/pg_conversion_fn.h index 8706012197a..6df77b3bf06 100644 --- a/src/include/catalog/pg_conversion_fn.h +++ b/src/include/catalog/pg_conversion_fn.h @@ -7,20 +7,17 @@ * Portions Copyright (c) 1996-2008, PostgreSQL Global Development Group * Portions Copyright (c) 1994, Regents of the University of California * - * $PostgreSQL: pgsql/src/include/catalog/pg_conversion_fn.h,v 1.1 2008/03/27 03:57:34 tgl Exp $ + * $PostgreSQL: pgsql/src/include/catalog/pg_conversion_fn.h,v 1.2 2008/06/14 18:04:34 tgl Exp $ * *------------------------------------------------------------------------- */ #ifndef PG_CONVERSION_FN_H #define PG_CONVERSION_FN_H -#include "nodes/parsenodes.h" - extern Oid ConversionCreate(const char *conname, Oid connamespace, Oid conowner, int32 conforencoding, int32 contoencoding, Oid conproc, bool def); -extern void ConversionDrop(Oid conversionOid, DropBehavior behavior); extern void RemoveConversionById(Oid conversionOid); extern Oid FindConversion(const char *conname, Oid connamespace); extern Oid FindDefaultConversion(Oid connamespace, int32 for_encoding, int32 to_encoding); diff --git a/src/include/commands/conversioncmds.h b/src/include/commands/conversioncmds.h index 570cb796224..815bbce3294 100644 --- a/src/include/commands/conversioncmds.h +++ b/src/include/commands/conversioncmds.h @@ -7,7 +7,7 @@ * Portions Copyright (c) 1996-2008, PostgreSQL Global Development Group * Portions Copyright (c) 1994, Regents of the University of California * - * $PostgreSQL: pgsql/src/include/commands/conversioncmds.h,v 1.16 2008/01/01 19:45:57 momjian Exp $ + * $PostgreSQL: pgsql/src/include/commands/conversioncmds.h,v 1.17 2008/06/14 18:04:34 tgl Exp $ * *------------------------------------------------------------------------- */ @@ -18,8 +18,7 @@ #include "nodes/parsenodes.h" extern void CreateConversionCommand(CreateConversionStmt *parsetree); -extern void DropConversionCommand(List *conversion_name, - DropBehavior behavior, bool missing_ok); +extern void DropConversionsCommand(DropStmt *drop); extern void RenameConversion(List *name, const char *newname); extern void AlterConversionOwner(List *name, Oid newOwnerId); extern void AlterConversionOwner_oid(Oid conversionOid, Oid newOwnerId); diff --git a/src/include/commands/defrem.h b/src/include/commands/defrem.h index 1270a7a5138..90e3a19f671 100644 --- a/src/include/commands/defrem.h +++ b/src/include/commands/defrem.h @@ -7,7 +7,7 @@ * Portions Copyright (c) 1996-2008, PostgreSQL Global Development Group * Portions Copyright (c) 1994, Regents of the University of California * - * $PostgreSQL: pgsql/src/include/commands/defrem.h,v 1.88 2008/01/01 19:45:57 momjian Exp $ + * $PostgreSQL: pgsql/src/include/commands/defrem.h,v 1.89 2008/06/14 18:04:34 tgl Exp $ * *------------------------------------------------------------------------- */ @@ -34,7 +34,6 @@ extern void DefineIndex(RangeVar *heapRelation, bool skip_build, bool quiet, bool concurrent); -extern void RemoveIndex(RangeVar *relation, DropBehavior behavior); extern void ReindexIndex(RangeVar *indexRelation); extern void ReindexTable(RangeVar *relation); extern void ReindexDatabase(const char *databaseName, @@ -94,28 +93,24 @@ extern void AlterOpFamilyOwner(List *name, const char *access_method, Oid newOwn /* commands/tsearchcmds.c */ extern void DefineTSParser(List *names, List *parameters); extern void RenameTSParser(List *oldname, const char *newname); -extern void RemoveTSParser(List *names, DropBehavior behavior, - bool missing_ok); +extern void RemoveTSParsers(DropStmt *drop); extern void RemoveTSParserById(Oid prsId); extern void DefineTSDictionary(List *names, List *parameters); extern void RenameTSDictionary(List *oldname, const char *newname); -extern void RemoveTSDictionary(List *names, DropBehavior behavior, - bool missing_ok); +extern void RemoveTSDictionaries(DropStmt *drop); extern void RemoveTSDictionaryById(Oid dictId); extern void AlterTSDictionary(AlterTSDictionaryStmt *stmt); extern void AlterTSDictionaryOwner(List *name, Oid newOwnerId); extern void DefineTSTemplate(List *names, List *parameters); extern void RenameTSTemplate(List *oldname, const char *newname); -extern void RemoveTSTemplate(List *names, DropBehavior behavior, - bool missing_ok); +extern void RemoveTSTemplates(DropStmt *stmt); extern void RemoveTSTemplateById(Oid tmplId); extern void DefineTSConfiguration(List *names, List *parameters); extern void RenameTSConfiguration(List *oldname, const char *newname); -extern void RemoveTSConfiguration(List *names, DropBehavior behavior, - bool missing_ok); +extern void RemoveTSConfigurations(DropStmt *stmt); extern void RemoveTSConfigurationById(Oid cfgId); extern void AlterTSConfiguration(AlterTSConfigurationStmt *stmt); extern void AlterTSConfigurationOwner(List *name, Oid newOwnerId); diff --git a/src/include/commands/schemacmds.h b/src/include/commands/schemacmds.h index f31407757b8..e0df980c368 100644 --- a/src/include/commands/schemacmds.h +++ b/src/include/commands/schemacmds.h @@ -7,7 +7,7 @@ * Portions Copyright (c) 1996-2008, PostgreSQL Global Development Group * Portions Copyright (c) 1994, Regents of the University of California * - * $PostgreSQL: pgsql/src/include/commands/schemacmds.h,v 1.18 2008/01/01 19:45:57 momjian Exp $ + * $PostgreSQL: pgsql/src/include/commands/schemacmds.h,v 1.19 2008/06/14 18:04:34 tgl Exp $ * *------------------------------------------------------------------------- */ @@ -20,7 +20,7 @@ extern void CreateSchemaCommand(CreateSchemaStmt *parsetree, const char *queryString); -extern void RemoveSchema(List *names, DropBehavior behavior, bool missing_ok); +extern void RemoveSchemas(DropStmt *drop); extern void RemoveSchemaById(Oid schemaOid); extern void RenameSchema(const char *oldname, const char *newname); diff --git a/src/include/commands/tablecmds.h b/src/include/commands/tablecmds.h index 700c1bd42ef..cdb80240169 100644 --- a/src/include/commands/tablecmds.h +++ b/src/include/commands/tablecmds.h @@ -7,7 +7,7 @@ * Portions Copyright (c) 1996-2008, PostgreSQL Global Development Group * Portions Copyright (c) 1994, Regents of the University of California * - * $PostgreSQL: pgsql/src/include/commands/tablecmds.h,v 1.38 2008/03/19 18:38:30 tgl Exp $ + * $PostgreSQL: pgsql/src/include/commands/tablecmds.h,v 1.39 2008/06/14 18:04:34 tgl Exp $ * *------------------------------------------------------------------------- */ @@ -20,7 +20,7 @@ extern Oid DefineRelation(CreateStmt *stmt, char relkind); -extern void RemoveRelation(const RangeVar *relation, DropBehavior behavior); +extern void RemoveRelations(DropStmt *drop); extern void AlterTable(AlterTableStmt *stmt); diff --git a/src/include/commands/typecmds.h b/src/include/commands/typecmds.h index ce807b56d08..ed0048c6c8e 100644 --- a/src/include/commands/typecmds.h +++ b/src/include/commands/typecmds.h @@ -7,7 +7,7 @@ * Portions Copyright (c) 1996-2008, PostgreSQL Global Development Group * Portions Copyright (c) 1994, Regents of the University of California * - * $PostgreSQL: pgsql/src/include/commands/typecmds.h,v 1.23 2008/03/19 18:38:30 tgl Exp $ + * $PostgreSQL: pgsql/src/include/commands/typecmds.h,v 1.24 2008/06/14 18:04:34 tgl Exp $ * *------------------------------------------------------------------------- */ @@ -20,10 +20,9 @@ #define DEFAULT_TYPDELIM ',' extern void DefineType(List *names, List *parameters); -extern void RemoveType(List *names, DropBehavior behavior, bool missing_ok); +extern void RemoveTypes(DropStmt *drop); extern void RemoveTypeById(Oid typeOid); extern void DefineDomain(CreateDomainStmt *stmt); -extern void RemoveDomain(List *names, DropBehavior behavior, bool missing_ok); extern void DefineEnum(CreateEnumStmt *stmt); extern Oid DefineCompositeType(const RangeVar *typevar, List *coldeflist); diff --git a/src/include/commands/view.h b/src/include/commands/view.h index daefb644d14..7046e67ec9f 100644 --- a/src/include/commands/view.h +++ b/src/include/commands/view.h @@ -7,7 +7,7 @@ * Portions Copyright (c) 1996-2008, PostgreSQL Global Development Group * Portions Copyright (c) 1994, Regents of the University of California * - * $PostgreSQL: pgsql/src/include/commands/view.h,v 1.26 2008/01/01 19:45:57 momjian Exp $ + * $PostgreSQL: pgsql/src/include/commands/view.h,v 1.27 2008/06/14 18:04:34 tgl Exp $ * *------------------------------------------------------------------------- */ @@ -17,6 +17,5 @@ #include "nodes/parsenodes.h" extern void DefineView(ViewStmt *stmt, const char *queryString); -extern void RemoveView(const RangeVar *view, DropBehavior behavior); #endif /* VIEW_H */ |
