mirror of
https://github.com/postgres/postgres.git
synced 2025-06-16 06:01:02 +03:00
Allow ALTER TYPE .. ADD ATTRIBUTE .. CASCADE to recurse to descendants.
Without this, adding an attribute to a typed table with an inheritance child fails, which is surprising. Noah Misch, with minor changes by me.
This commit is contained in:
@ -3876,7 +3876,8 @@ ATSimpleRecursion(List **wqueue, Relation rel,
|
||||
* ATTypedTableRecursion
|
||||
*
|
||||
* Propagate ALTER TYPE operations to the typed tables of that type.
|
||||
* Also check the RESTRICT/CASCADE behavior.
|
||||
* Also check the RESTRICT/CASCADE behavior. Given CASCADE, also permit
|
||||
* recursion to inheritance children of the typed tables.
|
||||
*/
|
||||
static void
|
||||
ATTypedTableRecursion(List **wqueue, Relation rel, AlterTableCmd *cmd,
|
||||
@ -3898,7 +3899,7 @@ ATTypedTableRecursion(List **wqueue, Relation rel, AlterTableCmd *cmd,
|
||||
|
||||
childrel = relation_open(childrelid, lockmode);
|
||||
CheckTableNotInUse(childrel, "ALTER TABLE");
|
||||
ATPrepCmd(wqueue, childrel, cmd, false, true, lockmode);
|
||||
ATPrepCmd(wqueue, childrel, cmd, true, true, lockmode);
|
||||
relation_close(childrel, NoLock);
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user