PostgreSQL implements table inheritance. For example, you can create a places table (geographical objects) and several tables that will inherit all its columns. Suppose these are tables for information about cities ( cities ), rivers ( rivers ) and lakes ( lakes ):
CREATE TABLE places (id, name, latitude, longitude, altitude); CREATE TABLE cities (population) INHERITS (places); CREATE TABLE rivers (lenght) INHERITS (places); CREATE TABLE lakes (maxdepth, volume) INHERITS (places);
Now suppose that we want to store information on books about these objects in the database. The relationship between the object and the books is one-to-many . How can this be done if we actually have data in tables-descendants and at the same time the uniqueness of the keys is valid only within the same table?
UPD. No This logic is not supposed to work in PostgreSQL.