From 874430af90aacdf8aaa3d2a0b47fe9ceb7962f9b Mon Sep 17 00:00:00 2001
From: Alvaro Herrera <alvherre@alvh.no-ip.org>
Date: Thu, 19 Feb 2015 16:29:57 -0300
Subject: [PATCH 03/44] deparse/core: have COMMENT return an ObjectAddress, not
 OID

---
 src/backend/commands/comment.c | 8 ++++----
 src/include/commands/comment.h | 3 ++-
 2 files changed, 6 insertions(+), 5 deletions(-)

diff --git a/src/backend/commands/comment.c b/src/backend/commands/comment.c
index ed1e46e..6d8c006 100644
--- a/src/backend/commands/comment.c
+++ b/src/backend/commands/comment.c
@@ -36,11 +36,11 @@
  * This routine is used to add the associated comment into
  * pg_description for the object specified by the given SQL command.
  */
-Oid
+ObjectAddress
 CommentObject(CommentStmt *stmt)
 {
-	ObjectAddress address;
 	Relation	relation;
+	ObjectAddress address = InvalidObjectAddress;
 
 	/*
 	 * When loading a dump, we may see a COMMENT ON DATABASE for the old name
@@ -60,7 +60,7 @@ CommentObject(CommentStmt *stmt)
 			ereport(WARNING,
 					(errcode(ERRCODE_UNDEFINED_DATABASE),
 					 errmsg("database \"%s\" does not exist", database)));
-			return InvalidOid;
+			return address;
 		}
 	}
 
@@ -126,7 +126,7 @@ CommentObject(CommentStmt *stmt)
 	if (relation != NULL)
 		relation_close(relation, NoLock);
 
-	return address.objectId;
+	return address;
 }
 
 /*
diff --git a/src/include/commands/comment.h b/src/include/commands/comment.h
index 3d61b44..990d362 100644
--- a/src/include/commands/comment.h
+++ b/src/include/commands/comment.h
@@ -15,6 +15,7 @@
 #ifndef COMMENT_H
 #define COMMENT_H
 
+#include "catalog/objectaddress.h"
 #include "nodes/parsenodes.h"
 
 /*------------------------------------------------------------------
@@ -29,7 +30,7 @@
  *------------------------------------------------------------------
  */
 
-extern Oid	CommentObject(CommentStmt *stmt);
+extern ObjectAddress CommentObject(CommentStmt *stmt);
 
 extern void DeleteComments(Oid oid, Oid classoid, int32 subid);
 
-- 
2.1.4

