From a2e35b53c39b2a27d3e332dc7c506539c306fd44 Mon Sep 17 00:00:00 2001 From: Alvaro Herrera Date: Tue, 3 Mar 2015 14:10:50 -0300 Subject: 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 --- src/backend/commands/tablespace.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) (limited to 'src/backend/commands/tablespace.c') diff --git a/src/backend/commands/tablespace.c b/src/backend/commands/tablespace.c index 03cc8fe8d80..68b6917df5d 100644 --- a/src/backend/commands/tablespace.c +++ b/src/backend/commands/tablespace.c @@ -846,7 +846,7 @@ directory_is_empty(const char *path) /* * Rename a tablespace */ -Oid +ObjectAddress RenameTableSpace(const char *oldname, const char *newname) { Oid tspId; @@ -856,6 +856,7 @@ RenameTableSpace(const char *oldname, const char *newname) HeapTuple tup; HeapTuple newtuple; Form_pg_tablespace newform; + ObjectAddress address; /* Search pg_tablespace */ rel = heap_open(TableSpaceRelationId, RowExclusiveLock); @@ -912,9 +913,11 @@ RenameTableSpace(const char *oldname, const char *newname) InvokeObjectPostAlterHook(TableSpaceRelationId, tspId, 0); + ObjectAddressSet(address, TableSpaceRelationId, tspId); + heap_close(rel, NoLock); - return tspId; + return address; } /* -- cgit v1.2.3