From 1fa9241bdd0e44d2b602b2dd4b6f0a4d0d402e76 Mon Sep 17 00:00:00 2001 From: Peter Eisentraut Date: Tue, 29 Aug 2023 08:41:04 +0200 Subject: Make more use of makeColumnDef() Since we already have it, we might as well make full use of it, instead of assembling ColumnDef by hand in several places. Reviewed-by: Alvaro Herrera Discussion: https://www.postgresql.org/message-id/flat/52a125e4-ff9a-95f5-9f61-b87cf447e4da@eisentraut.org --- src/backend/commands/tablecmds.c | 15 ++------------- 1 file changed, 2 insertions(+), 13 deletions(-) (limited to 'src/backend/commands/tablecmds.c') diff --git a/src/backend/commands/tablecmds.c b/src/backend/commands/tablecmds.c index 2ac6f8b334f..a8c40ace10c 100644 --- a/src/backend/commands/tablecmds.c +++ b/src/backend/commands/tablecmds.c @@ -2755,10 +2755,8 @@ MergeAttributes(List *schema, List *supers, char relpersistence, /* * No, create a new inherited column */ - def = makeNode(ColumnDef); - def->colname = pstrdup(attributeName); - def->typeName = makeTypeNameFromOid(attribute->atttypid, - attribute->atttypmod); + def = makeColumnDef(attributeName, attribute->atttypid, + attribute->atttypmod, attribute->attcollation); def->inhcount = 1; def->is_local = false; /* mark attnotnull if parent has it and it's not NO INHERIT */ @@ -2766,20 +2764,11 @@ MergeAttributes(List *schema, List *supers, char relpersistence, bms_is_member(parent_attno - FirstLowInvalidHeapAttributeNumber, pkattrs)) def->is_not_null = true; - def->is_from_type = false; def->storage = attribute->attstorage; - def->raw_default = NULL; - def->cooked_default = NULL; def->generated = attribute->attgenerated; - def->collClause = NULL; - def->collOid = attribute->attcollation; - def->constraints = NIL; - def->location = -1; if (CompressionMethodIsValid(attribute->attcompression)) def->compression = pstrdup(GetCompressionMethodName(attribute->attcompression)); - else - def->compression = NULL; inhSchema = lappend(inhSchema, def); newattmap->attnums[parent_attno - 1] = ++child_attno; -- cgit v1.2.3