From e12a69675919fb026c008e37649518f3d52e2a90 Mon Sep 17 00:00:00 2001 From: Peter Eisentraut Date: Thu, 22 Jun 2023 12:05:06 +0200 Subject: [PATCH 02/17] Remove ancient special case code for adding oid columns The special handling of negative attribute numbers in ATExecAddColumn() was introduced to support SET WITH OIDS (commit 6d1e361852). But that feature doesn't exist anymore, so we can revert to the previous, simpler version. In passing, also remove an obsolete comment about OID support. --- src/backend/commands/tablecmds.c | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/src/backend/commands/tablecmds.c b/src/backend/commands/tablecmds.c index d985278ac6..a5493705aa 100644 --- a/src/backend/commands/tablecmds.c +++ b/src/backend/commands/tablecmds.c @@ -2449,8 +2449,7 @@ MergeAttributes(List *schema, List *supers, char relpersistence, /* * Scan the parents left-to-right, and merge their attributes to form a - * list of inherited attributes (inhSchema). Also check to see if we need - * to inherit an OID column. + * list of inherited attributes (inhSchema). */ child_attno = 0; foreach(entry, supers) @@ -6944,7 +6943,7 @@ ATExecAddColumn(List **wqueue, AlteredTableInfo *tab, Relation rel, attribute.attrelid = myrelid; namestrcpy(&(attribute.attname), colDef->colname); attribute.atttypid = typeOid; - attribute.attstattarget = (newattnum > 0) ? -1 : 0; + attribute.attstattarget = -1; attribute.attlen = tform->typlen; attribute.attnum = newattnum; if (list_length(colDef->typeName->arrayBounds) > PG_INT16_MAX) @@ -7067,7 +7066,7 @@ ATExecAddColumn(List **wqueue, AlteredTableInfo *tab, Relation rel, * is certainly not going to touch them. System attributes don't have * interesting defaults, either. */ - if (RELKIND_HAS_STORAGE(relkind) && attribute.attnum > 0) + if (RELKIND_HAS_STORAGE(relkind)) { /* * For an identity column, we can't use build_column_default(), -- 2.41.0