* created NOT NULL during CREATE TABLE), do an ALTER SET NOT NULL to mark
* them so --- or fail if they are not in fact nonnull.
*
+ * As of PG v10, the SET NOT NULL is applied to child tables as well, so
+ * that the behavior is like a manual SET NOT NULL.
+ *
* Caller had better have at least ShareLock on the table, else the not-null
* checking isn't trustworthy.
*/
}
/*
- * XXX: Shouldn't the ALTER TABLE .. SET NOT NULL cascade to child tables?
- * Currently, since the PRIMARY KEY itself doesn't cascade, we don't
- * cascade the notnull constraint(s) either; but this is pretty debatable.
- *
* XXX: possible future improvement: when being called from ALTER TABLE,
* it would be more efficient to merge this with the outer ALTER TABLE, so
* as to avoid two scans. But that seems to complicate DefineIndex's API
* unduly.
*/
if (cmds)
- AlterTableInternal(RelationGetRelid(heapRel), cmds, false);
+ AlterTableInternal(RelationGetRelid(heapRel), cmds, true);
}
/*
Table "public.constraint_rename_test2"
Column | Type | Collation | Nullable | Default
--------+---------+-----------+----------+---------
- a | integer | | |
+ a | integer | | not null |
b | integer | | |
c | integer | | |
d | integer | | |