A
A
Alexandra2015-06-24 13:54:42
PostgreSQL
Alexandra, 2015-06-24 13:54:42

What needs to be done for the supertype-subtype to work correctly in postgresql?

I have a real estate database. created a common table "object", and attached "apartment" and "house" to it by inheritance, when adding, I fill in the subtables, the counter enters id into the main table. But when I try to enter the object id in the table, the owner pops up an error that there is no such object id, although it exists in the main table "objects". how to deal with this story?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
A
Alexander, 2015-06-24
@liff

Read about table inheritance in postgres. www.postgresql.org/docs/9.4/static/tutorial-inheri... The data is stored in the table where they were added, they really are not in the other, although the records are visible if you use the query in the selection without ONLY.
For example select * from only children_table; or select * from only parent_table;
As a result, you will see the data that is actually in the specified table.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question