Push attidentity and attgenerated handling into BuildDescForRelation()
authorPeter Eisentraut <[email protected]>
Thu, 5 Oct 2023 14:17:16 +0000 (16:17 +0200)
committerPeter Eisentraut <[email protected]>
Thu, 5 Oct 2023 14:20:46 +0000 (16:20 +0200)
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.

Reviewed-by: Alvaro Herrera <[email protected]>
Discussion: https://www.postgresql.org/message-id/flat/52a125e4-ff9a-95f5-9f61-b87cf447e4da@eisentraut.org

src/backend/access/common/tupdesc.c
src/backend/commands/tablecmds.c

index ce2c7bce8566f41a146a4683262c7a19aa6383e1..c2e7b14c31e73b3fe04347c346d720df73f15a70 100644 (file)
@@ -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)
index 73b8dea81c8a7fdbae20ef54af280ed4c7655c08..60ede984e02e4c26750a5fa34feed609ef0f42ef 100644 (file)
@@ -941,8 +941,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);