I am currently trying to see how the object oriented features come in play in Postgres. During a few tests I noticed that when you insert in or delete from inheriting tables that those changes also happen to the supertable and vice versa.
Question 1: How is data physically stored if you have 2 tables and table 1 has no constraints but table 2 has an identity primary key column and also inherits columns from table 1.
Question 2: Since one table inherits columns from the other and inserts in table 2 result also in population of table 1, is the data stored completely isolated and redundant in two different tuples on different pages or is are the tuples linked somehow? And if its separated, does that mean both tuples get locked in case of a writing operation?
Question 3: How does an index affect table inheritance?
Question 4: What's an actual use for object oriented features in Postgres?
The tables used:
create table person (
nachname varchar(30),
age int,
eigenschaft varchar(30)
)
create table praktikant (
praktikant_id int generated always as identity primary key,
klassenstufe int) inherits(person);
the insert:
insert into praktikant(nachname, age, eigenschaft, klassenstufe)
values('Schmidt', 16, 'fleißig', 9)