Skip to content

Commit 5eaa0e9

Browse files
committed
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 6d1e361). 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. Reviewed-by: Alvaro Herrera <alvherre@alvh.no-ip.org> Discussion: https://www.postgresql.org/message-id/flat/52a125e4-ff9a-95f5-9f61-b87cf447e4da@eisentraut.org
1 parent adf333b commit 5eaa0e9

File tree

1 file changed

+3
-4
lines changed

1 file changed

+3
-4
lines changed

src/backend/commands/tablecmds.c

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2450,8 +2450,7 @@ MergeAttributes(List *schema, List *supers, char relpersistence,
24502450

24512451
/*
24522452
* Scan the parents left-to-right, and merge their attributes to form a
2453-
* list of inherited attributes (inhSchema). Also check to see if we need
2454-
* to inherit an OID column.
2453+
* list of inherited attributes (inhSchema).
24552454
*/
24562455
child_attno = 0;
24572456
foreach(entry, supers)
@@ -6945,7 +6944,7 @@ ATExecAddColumn(List **wqueue, AlteredTableInfo *tab, Relation rel,
69456944
attribute.attrelid = myrelid;
69466945
namestrcpy(&(attribute.attname), colDef->colname);
69476946
attribute.atttypid = typeOid;
6948-
attribute.attstattarget = (newattnum > 0) ? -1 : 0;
6947+
attribute.attstattarget = -1;
69496948
attribute.attlen = tform->typlen;
69506949
attribute.attnum = newattnum;
69516950
if (list_length(colDef->typeName->arrayBounds) > PG_INT16_MAX)
@@ -7068,7 +7067,7 @@ ATExecAddColumn(List **wqueue, AlteredTableInfo *tab, Relation rel,
70687067
* is certainly not going to touch them. System attributes don't have
70697068
* interesting defaults, either.
70707069
*/
7071-
if (RELKIND_HAS_STORAGE(relkind) && attribute.attnum > 0)
7070+
if (RELKIND_HAS_STORAGE(relkind))
70727071
{
70737072
/*
70747073
* For an identity column, we can't use build_column_default(),

0 commit comments

Comments
 (0)