Fixes to table inheritance
Previously
Fixes #3024
There are two main fixes in this PR
-
Any alterations to a parent table never propagated to the children. This is because the columns of the parent table(s) were only added on table create.
-
Not null overrides on child tables were not applied correctly. This is because there was a shared column reference between the parent and child tables. When any override for any child table existed, it was applied to the shared reference, which actually affected (incorrectly) other tables.
Now
- Changes to a parent table are propagated to the child tables
- Child tables have their own copy of the column definition. Overriding on a single table only affects the column definition on the table which it was declared. Parent / Sibling tables are no longer affected.
How does this work?
When a child table inherits from a parent, we now update the parent table to have references to the child table. When we apply an alter statement to the parent, we also recursively traverse the children and apply the same alteration to the children.
hi @kyleconroy -- is there any hope of this change getting reviewed / merged? Are there concerns about it the implementation or anything? I know the core maintainers are busy so I'd like to do what I can to help.
Hello @kyleconroy , It would be great if this could get reviewed because we really need this functionality.