aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRobert Haas <rhaas@postgresql.org>2011-02-04 16:14:54 -0500
committerRobert Haas <rhaas@postgresql.org>2011-02-04 16:14:54 -0500
commit9e7e1172a53054dc14574e42865ea8213bc06371 (patch)
treebebb00143e23a960f4422b20aca4e5cdff89f442
parentb1e65c32168a2b64276a57be8c4dc5a63d33e12d (diff)
downloadpostgresql-9e7e1172a53054dc14574e42865ea8213bc06371.tar.gz
postgresql-9e7e1172a53054dc14574e42865ea8213bc06371.zip
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.
-rw-r--r--src/backend/commands/tablecmds.c14
1 files changed, 9 insertions, 5 deletions
diff --git a/src/backend/commands/tablecmds.c b/src/backend/commands/tablecmds.c
index 1ecba027855..7a028991213 100644
--- a/src/backend/commands/tablecmds.c
+++ b/src/backend/commands/tablecmds.c
@@ -3378,12 +3378,16 @@ ATRewriteTable(AlteredTableInfo *tab, Oid OIDNewHeap, LOCKMODE lockmode)
}
/*
- * If we need to rewrite the table, the operation has to be propagated to
- * tables that use this table's rowtype as a column type.
+ * If we change column data types or add/remove OIDs, the operation has to
+ * be propagated to tables that use this table's rowtype as a column type.
+ * newrel will also be non-NULL in the case where we're adding a column
+ * with a default. We choose to forbid that case as well, since composite
+ * types might eventually support defaults.
*
- * (Eventually this will probably become true for scans as well, but at
- * the moment a composite type does not enforce any constraints, so it's
- * not necessary/appropriate to enforce them just during ALTER.)
+ * (Eventually we'll probably need to check for composite type
+ * dependencies even when we're just scanning the table without a rewrite,
+ * but at the moment a composite type does not enforce any constraints,
+ * so it's not necessary/appropriate to enforce them just during ALTER.)
*/
if (newrel)
find_composite_type_dependencies(oldrel->rd_rel->reltype,