From 1d513672df3c01a731d54de0da68a7f3e1c0d289 Mon Sep 17 00:00:00 2001 From: Peter Eisentraut Date: Wed, 28 Jun 2023 17:17:22 +0200 Subject: [PATCH 12/17] 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 | 4 ---- 2 files changed, 2 insertions(+), 4 deletions(-) diff --git a/src/backend/access/common/tupdesc.c b/src/backend/access/common/tupdesc.c index 253d6c86f8..bc1b67e6c9 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 cee4f0186c..06e4527dd1 100644 --- a/src/backend/commands/tablecmds.c +++ b/src/backend/commands/tablecmds.c @@ -927,8 +927,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); @@ -6899,8 +6897,6 @@ ATExecAddColumn(List **wqueue, AlteredTableInfo *tab, Relation rel, * Additional fields not handled by BuildDescForRelation() (mirrors * DefineRelation()) */ - attribute->attidentity = colDef->identity; - attribute->attgenerated = colDef->generated; attribute->attcompression = GetAttributeCompression(attribute->atttypid, colDef->compression); if (colDef->storage_name) attribute->attstorage = GetAttributeStorage(attribute->atttypid, colDef->storage_name); -- 2.41.0