diff options
author | Alvaro Herrera <alvherre@alvh.no-ip.org> | 2015-03-03 14:10:50 -0300 |
---|---|---|
committer | Alvaro Herrera <alvherre@alvh.no-ip.org> | 2015-03-03 14:10:50 -0300 |
commit | a2e35b53c39b2a27d3e332dc7c506539c306fd44 (patch) | |
tree | 1f4cd33208d33f4a8b3159b0d3757109c67d4b14 /src/include/commands/defrem.h | |
parent | 6f9d79904748c26a58991942dc6719db558f77b0 (diff) | |
download | postgresql-a2e35b53c39b2a27d3e332dc7c506539c306fd44.tar.gz postgresql-a2e35b53c39b2a27d3e332dc7c506539c306fd44.zip |
Change many routines to return ObjectAddress rather than OID
The changed routines are mostly those that can be directly called by
ProcessUtilitySlow; the intention is to make the affected object
information more precise, in support for future event trigger changes.
Originally it was envisioned that the OID of the affected object would
be enough, and in most cases that is correct, but upon actually
implementing the event trigger changes it turned out that ObjectAddress
is more widely useful.
Additionally, some command execution routines grew an output argument
that's an object address which provides further info about the executed
command. To wit:
* for ALTER DOMAIN / ADD CONSTRAINT, it corresponds to the address of
the new constraint
* for ALTER OBJECT / SET SCHEMA, it corresponds to the address of the
schema that originally contained the object.
* for ALTER EXTENSION {ADD, DROP} OBJECT, it corresponds to the address
of the object added to or dropped from the extension.
There's no user-visible change in this commit, and no functional change
either.
Discussion: 20150218213255.GC6717@tamriel.snowman.net
Reviewed-By: Stephen Frost, Andres Freund
Diffstat (limited to 'src/include/commands/defrem.h')
-rw-r--r-- | src/include/commands/defrem.h | 45 |
1 files changed, 23 insertions, 22 deletions
diff --git a/src/include/commands/defrem.h b/src/include/commands/defrem.h index cf586feac36..9e3e93b6055 100644 --- a/src/include/commands/defrem.h +++ b/src/include/commands/defrem.h @@ -14,6 +14,7 @@ #ifndef DEFREM_H #define DEFREM_H +#include "catalog/objectaddress.h" #include "nodes/parsenodes.h" #include "utils/array.h" @@ -21,7 +22,7 @@ extern void RemoveObjects(DropStmt *stmt); /* commands/indexcmds.c */ -extern Oid DefineIndex(Oid relationId, +extern ObjectAddress DefineIndex(Oid relationId, IndexStmt *stmt, Oid indexRelationId, bool is_alter_table, @@ -42,12 +43,12 @@ extern bool CheckIndexCompatible(Oid oldId, extern Oid GetDefaultOpClass(Oid type_id, Oid am_id); /* commands/functioncmds.c */ -extern Oid CreateFunction(CreateFunctionStmt *stmt, const char *queryString); +extern ObjectAddress CreateFunction(CreateFunctionStmt *stmt, const char *queryString); extern void RemoveFunctionById(Oid funcOid); extern void SetFunctionReturnType(Oid funcOid, Oid newRetType); extern void SetFunctionArgType(Oid funcOid, int argIndex, Oid newArgType); -extern Oid AlterFunction(AlterFunctionStmt *stmt); -extern Oid CreateCast(CreateCastStmt *stmt); +extern ObjectAddress AlterFunction(AlterFunctionStmt *stmt); +extern ObjectAddress CreateCast(CreateCastStmt *stmt); extern void DropCastById(Oid castOid); extern void IsThereFunctionInNamespace(const char *proname, int pronargs, oidvector *proargtypes, Oid nspOid); @@ -66,16 +67,16 @@ extern void interpret_function_parameter_list(List *parameters, Oid *requiredResultType); /* commands/operatorcmds.c */ -extern Oid DefineOperator(List *names, List *parameters); +extern ObjectAddress DefineOperator(List *names, List *parameters); extern void RemoveOperatorById(Oid operOid); /* commands/aggregatecmds.c */ -extern Oid DefineAggregate(List *name, List *args, bool oldstyle, +extern ObjectAddress DefineAggregate(List *name, List *args, bool oldstyle, List *parameters, const char *queryString); /* commands/opclasscmds.c */ -extern Oid DefineOpClass(CreateOpClassStmt *stmt); -extern Oid DefineOpFamily(CreateOpFamilyStmt *stmt); +extern ObjectAddress DefineOpClass(CreateOpClassStmt *stmt); +extern ObjectAddress DefineOpFamily(CreateOpFamilyStmt *stmt); extern Oid AlterOpFamily(AlterOpFamilyStmt *stmt); extern void RemoveOpClassById(Oid opclassOid); extern void RemoveOpFamilyById(Oid opfamilyOid); @@ -90,36 +91,36 @@ extern Oid get_opclass_oid(Oid amID, List *opclassname, bool missing_ok); extern Oid get_opfamily_oid(Oid amID, List *opfamilyname, bool missing_ok); /* commands/tsearchcmds.c */ -extern Oid DefineTSParser(List *names, List *parameters); +extern ObjectAddress DefineTSParser(List *names, List *parameters); extern void RemoveTSParserById(Oid prsId); -extern Oid DefineTSDictionary(List *names, List *parameters); +extern ObjectAddress DefineTSDictionary(List *names, List *parameters); extern void RemoveTSDictionaryById(Oid dictId); -extern Oid AlterTSDictionary(AlterTSDictionaryStmt *stmt); +extern ObjectAddress AlterTSDictionary(AlterTSDictionaryStmt *stmt); -extern Oid DefineTSTemplate(List *names, List *parameters); +extern ObjectAddress DefineTSTemplate(List *names, List *parameters); extern void RemoveTSTemplateById(Oid tmplId); -extern Oid DefineTSConfiguration(List *names, List *parameters); +extern ObjectAddress DefineTSConfiguration(List *names, List *parameters); extern void RemoveTSConfigurationById(Oid cfgId); -extern Oid AlterTSConfiguration(AlterTSConfigurationStmt *stmt); +extern ObjectAddress AlterTSConfiguration(AlterTSConfigurationStmt *stmt); extern text *serialize_deflist(List *deflist); extern List *deserialize_deflist(Datum txt); /* commands/foreigncmds.c */ -extern Oid AlterForeignServerOwner(const char *name, Oid newOwnerId); +extern ObjectAddress AlterForeignServerOwner(const char *name, Oid newOwnerId); extern void AlterForeignServerOwner_oid(Oid, Oid newOwnerId); -extern Oid AlterForeignDataWrapperOwner(const char *name, Oid newOwnerId); +extern ObjectAddress AlterForeignDataWrapperOwner(const char *name, Oid newOwnerId); extern void AlterForeignDataWrapperOwner_oid(Oid fwdId, Oid newOwnerId); -extern Oid CreateForeignDataWrapper(CreateFdwStmt *stmt); -extern Oid AlterForeignDataWrapper(AlterFdwStmt *stmt); +extern ObjectAddress CreateForeignDataWrapper(CreateFdwStmt *stmt); +extern ObjectAddress AlterForeignDataWrapper(AlterFdwStmt *stmt); extern void RemoveForeignDataWrapperById(Oid fdwId); -extern Oid CreateForeignServer(CreateForeignServerStmt *stmt); -extern Oid AlterForeignServer(AlterForeignServerStmt *stmt); +extern ObjectAddress CreateForeignServer(CreateForeignServerStmt *stmt); +extern ObjectAddress AlterForeignServer(AlterForeignServerStmt *stmt); extern void RemoveForeignServerById(Oid srvId); -extern Oid CreateUserMapping(CreateUserMappingStmt *stmt); -extern Oid AlterUserMapping(AlterUserMappingStmt *stmt); +extern ObjectAddress CreateUserMapping(CreateUserMappingStmt *stmt); +extern ObjectAddress AlterUserMapping(AlterUserMappingStmt *stmt); extern Oid RemoveUserMapping(DropUserMappingStmt *stmt); extern void RemoveUserMappingById(Oid umId); extern void CreateForeignTable(CreateForeignTableStmt *stmt, Oid relid); |