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/typecmds.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/typecmds.h')
-rw-r--r-- | src/include/commands/typecmds.h | 30 |
1 files changed, 16 insertions, 14 deletions
diff --git a/src/include/commands/typecmds.h b/src/include/commands/typecmds.h index 0a638002c3c..ef4b41b5a55 100644 --- a/src/include/commands/typecmds.h +++ b/src/include/commands/typecmds.h @@ -21,29 +21,31 @@ #define DEFAULT_TYPDELIM ',' -extern Oid DefineType(List *names, List *parameters); +extern ObjectAddress DefineType(List *names, List *parameters); extern void RemoveTypeById(Oid typeOid); -extern Oid DefineDomain(CreateDomainStmt *stmt); -extern Oid DefineEnum(CreateEnumStmt *stmt); -extern Oid DefineRange(CreateRangeStmt *stmt); -extern Oid AlterEnum(AlterEnumStmt *stmt, bool isTopLevel); -extern Oid DefineCompositeType(RangeVar *typevar, List *coldeflist); +extern ObjectAddress DefineDomain(CreateDomainStmt *stmt); +extern ObjectAddress DefineEnum(CreateEnumStmt *stmt); +extern ObjectAddress DefineRange(CreateRangeStmt *stmt); +extern ObjectAddress AlterEnum(AlterEnumStmt *stmt, bool isTopLevel); +extern ObjectAddress DefineCompositeType(RangeVar *typevar, List *coldeflist); extern Oid AssignTypeArrayOid(void); -extern Oid AlterDomainDefault(List *names, Node *defaultRaw); -extern Oid AlterDomainNotNull(List *names, bool notNull); -extern Oid AlterDomainAddConstraint(List *names, Node *constr); -extern Oid AlterDomainValidateConstraint(List *names, char *constrName); -extern Oid AlterDomainDropConstraint(List *names, const char *constrName, +extern ObjectAddress AlterDomainDefault(List *names, Node *defaultRaw); +extern ObjectAddress AlterDomainNotNull(List *names, bool notNull); +extern ObjectAddress AlterDomainAddConstraint(List *names, Node *constr, + ObjectAddress *constrAddr); +extern ObjectAddress AlterDomainValidateConstraint(List *names, char *constrName); +extern ObjectAddress AlterDomainDropConstraint(List *names, const char *constrName, DropBehavior behavior, bool missing_ok); extern void checkDomainOwner(HeapTuple tup); -extern Oid RenameType(RenameStmt *stmt); -extern Oid AlterTypeOwner(List *names, Oid newOwnerId, ObjectType objecttype); +extern ObjectAddress RenameType(RenameStmt *stmt); +extern ObjectAddress AlterTypeOwner(List *names, Oid newOwnerId, ObjectType objecttype); extern void AlterTypeOwnerInternal(Oid typeOid, Oid newOwnerId, bool hasDependEntry); -extern Oid AlterTypeNamespace(List *names, const char *newschema, ObjectType objecttype); +extern ObjectAddress AlterTypeNamespace(List *names, const char *newschema, + ObjectType objecttype, Oid *oldschema); extern Oid AlterTypeNamespace_oid(Oid typeOid, Oid nspOid, ObjectAddresses *objsMoved); extern Oid AlterTypeNamespaceInternal(Oid typeOid, Oid nspOid, bool isImplicitArray, |