v2-0006-Push-attidentity-and-attgenerated-handling-into-B.patch

text/plain

Filename: v2-0006-Push-attidentity-and-attgenerated-handling-into-B.patch
Type: text/plain
Part: 5
Message: Re: tablecmds.c/MergeAttributes() cleanup

Patch

Format: format-patch
Series: patch v2-0006
Subject: Push attidentity and attgenerated handling into BuildDescForRelation()
File+
src/backend/access/common/tupdesc.c 2 0
src/backend/commands/tablecmds.c 0 2
From 622b51c51f5f0d52abea5fc08931811ca6b994df Mon Sep 17 00:00:00 2001
From: Peter Eisentraut <peter@eisentraut.org>
Date: Wed, 12 Jul 2023 16:12:35 +0200
Subject: [PATCH v2 06/10] Push attidentity and attgenerated handling into
 BuildDescForRelation()

Previously, this was handled by the callers separately, but it can be
trivially moved into BuildDescForRelation() so that it is handled in a
central place.
---
 src/backend/access/common/tupdesc.c | 2 ++
 src/backend/commands/tablecmds.c    | 2 --
 2 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/src/backend/access/common/tupdesc.c b/src/backend/access/common/tupdesc.c
index ce2c7bce85..c2e7b14c31 100644
--- a/src/backend/access/common/tupdesc.c
+++ b/src/backend/access/common/tupdesc.c
@@ -856,6 +856,8 @@ BuildDescForRelation(const List *columns)
 		has_not_null |= entry->is_not_null;
 		att->attislocal = entry->is_local;
 		att->attinhcount = entry->inhcount;
+		att->attidentity = entry->identity;
+		att->attgenerated = entry->generated;
 	}
 
 	if (has_not_null)
diff --git a/src/backend/commands/tablecmds.c b/src/backend/commands/tablecmds.c
index 0a7101dadc..c3a8cd58dd 100644
--- a/src/backend/commands/tablecmds.c
+++ b/src/backend/commands/tablecmds.c
@@ -942,8 +942,6 @@ DefineRelation(CreateStmt *stmt, char relkind, Oid ownerId,
 			attr->atthasdef = true;
 		}
 
-		attr->attidentity = colDef->identity;
-		attr->attgenerated = colDef->generated;
 		attr->attcompression = GetAttributeCompression(attr->atttypid, colDef->compression);
 		if (colDef->storage_name)
 			attr->attstorage = GetAttributeStorage(attr->atttypid, colDef->storage_name);
-- 
2.41.0