Suppose I have a table Bars
inheriting a table Foos
.
How could I promote a foo
to a bar
?
Demoting a bar
to a foo
would be simple, by just deleting the row from Bars
.
Suppose I have a table Bars
inheriting a table Foos
.
How could I promote a foo
to a bar
?
Demoting a bar
to a foo
would be simple, by just deleting the row from Bars
.
The doc on Inheritance tells you:
Inheritance does not automatically propagate data from INSERT or COPY commands to other tables in the inheritance hierarchy.
This means, that you have to delete the row from the parent table and insert a new one into the child table.
You say:
Demoting a bar to a foo would be simple, by just deleting the row from Bars.
This makes me think, you misunderstand how inheritance works in PostgreSQL. Basically you have two tables, the Bar
table has the same columns as Foo
plus the any additional columns. Inserting a Bar
writes data only into Bar
, no "common data" will be written to Foo
. When you delete the row from Bar
then your data will not be "demoted", it will be gone completely. So both promoting and demoting require you do shuffle data between tables.
You can read the long story in the fine manual I've linked :-)