Skip to content

Commit 9e7e117

Browse files
committed
Clarify comment in ATRewriteTable().
Make sure it's clear that the prohibition on adding a column with a default when the rowtype is used elsewhere is intentional, and be a bit more explicit about the other cases where we perform this check.
1 parent b1e65c3 commit 9e7e117

File tree

1 file changed

+9
-5
lines changed

1 file changed

+9
-5
lines changed

src/backend/commands/tablecmds.c

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -3378,12 +3378,16 @@ ATRewriteTable(AlteredTableInfo *tab, Oid OIDNewHeap, LOCKMODE lockmode)
33783378
}
33793379

33803380
/*
3381-
* If we need to rewrite the table, the operation has to be propagated to
3382-
* tables that use this table's rowtype as a column type.
3381+
* If we change column data types or add/remove OIDs, the operation has to
3382+
* be propagated to tables that use this table's rowtype as a column type.
3383+
* newrel will also be non-NULL in the case where we're adding a column
3384+
* with a default. We choose to forbid that case as well, since composite
3385+
* types might eventually support defaults.
33833386
*
3384-
* (Eventually this will probably become true for scans as well, but at
3385-
* the moment a composite type does not enforce any constraints, so it's
3386-
* not necessary/appropriate to enforce them just during ALTER.)
3387+
* (Eventually we'll probably need to check for composite type
3388+
* dependencies even when we're just scanning the table without a rewrite,
3389+
* but at the moment a composite type does not enforce any constraints,
3390+
* so it's not necessary/appropriate to enforce them just during ALTER.)
33873391
*/
33883392
if (newrel)
33893393
find_composite_type_dependencies(oldrel->rd_rel->reltype,

0 commit comments

Comments
 (0)