mirror of
https://github.com/postgres/postgres.git
synced 2025-07-08 11:42:09 +03:00
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
This commit is contained in:
@ -246,7 +246,7 @@ get_opclass_oid(Oid amID, List *opclassname, bool missing_ok)
|
||||
*
|
||||
* Caller must have done permissions checks etc. already.
|
||||
*/
|
||||
static Oid
|
||||
static ObjectAddress
|
||||
CreateOpFamily(char *amname, char *opfname, Oid namespaceoid, Oid amoid)
|
||||
{
|
||||
Oid opfamilyoid;
|
||||
@ -319,14 +319,14 @@ CreateOpFamily(char *amname, char *opfname, Oid namespaceoid, Oid amoid)
|
||||
|
||||
heap_close(rel, RowExclusiveLock);
|
||||
|
||||
return opfamilyoid;
|
||||
return myself;
|
||||
}
|
||||
|
||||
/*
|
||||
* DefineOpClass
|
||||
* Define a new index operator class.
|
||||
*/
|
||||
Oid
|
||||
ObjectAddress
|
||||
DefineOpClass(CreateOpClassStmt *stmt)
|
||||
{
|
||||
char *opcname; /* name of opclass we're creating */
|
||||
@ -445,11 +445,14 @@ DefineOpClass(CreateOpClassStmt *stmt)
|
||||
}
|
||||
else
|
||||
{
|
||||
ObjectAddress tmpAddr;
|
||||
|
||||
/*
|
||||
* Create it ... again no need for more permissions ...
|
||||
*/
|
||||
opfamilyoid = CreateOpFamily(stmt->amname, opcname,
|
||||
namespaceoid, amoid);
|
||||
tmpAddr = CreateOpFamily(stmt->amname, opcname,
|
||||
namespaceoid, amoid);
|
||||
opfamilyoid = tmpAddr.objectId;
|
||||
}
|
||||
}
|
||||
|
||||
@ -719,7 +722,7 @@ DefineOpClass(CreateOpClassStmt *stmt)
|
||||
|
||||
heap_close(rel, RowExclusiveLock);
|
||||
|
||||
return opclassoid;
|
||||
return myself;
|
||||
}
|
||||
|
||||
|
||||
@ -727,7 +730,7 @@ DefineOpClass(CreateOpClassStmt *stmt)
|
||||
* DefineOpFamily
|
||||
* Define a new index operator family.
|
||||
*/
|
||||
Oid
|
||||
ObjectAddress
|
||||
DefineOpFamily(CreateOpFamilyStmt *stmt)
|
||||
{
|
||||
char *opfname; /* name of opfamily we're creating */
|
||||
|
Reference in New Issue
Block a user