How does inheritance work in PostgreSQL? Is it a good practice within relational database frameworks? How do you use it?
How does inheritance work in PostgreSQL? Is it a good practice within relational database frameworks? How do you use it?
It does not work. In practice, it is implemented in half and it is very rare to be useful for anything, although what works is not especially problematic.
In general it is not a "good practice" to try to reproduce the object-oriented model in a relational database. It gives more work to do right than to do the traditional way. Maybe it was different if everything was done perfectly, but they quit because it was not really that useful and would never look as good as people expect.
So I will not even try to explain the workings, no one in their right mind uses, at least as a true inheritance. There is the use for partitioning, but it is to use the inheritance mechanism not to inherit, but to meet another need.
When you have several tables with the same structure that need to be grouped somehow the inheritance can be used, but note that this is not a true inheritance as we know it in object orientation.