Re: Visibility of data from table inherits function

Поиск
Список
Период
Сортировка
От Francisco Olarte
Тема Re: Visibility of data from table inherits function
Дата
Msg-id CA+bJJbwsUtM-fpcPAVcNuPoyGkqwhoSnFTBY8gSBJ5zOKpBdug@mail.gmail.com
обсуждение исходный текст
Ответ на Visibility of data from table inherits function  (ourdiaspora <ourdiaspora@protonmail.com>)
Ответы Re: Visibility of data from table inherits function
Список pgsql-general
On Sun, 2 Jan 2022 at 13:23, ourdiaspora <ourdiaspora@protonmail.com> wrote:
> CREATE TABLE exampletable (
> name varchar(200)
> );
...
> CREATE TABLE exampletablechild (dates DATE) INHERITS (exampletable);
...
> Please could someone explain why the data in the table 'exampletable' is not visible from the query using the child
table?
> Does not 'INHERIT' function apply to the data of the precedent parent table?

No, it works the other way round, somehow like OO inheritance.

When you query a table you will see its data and all of the tables
that inherit from it.

Take a look at https://www.postgresql.org/docs/14/tutorial-inheritance.html
. Ii is not shown there, but you canot see cities through capitals
because they do not have state, so they do not match the structure,
but you can see capitals through cities.

Inherits does not copy things. LIKE on creation does, but AFAIK it can
copy nearly everything except data.

Francisco Olarte.



В списке pgsql-general по дате отправления:

Предыдущее
От: "David G. Johnston"
Дата:
Сообщение: Re: Visibility of data from table inherits function
Следующее
От: ourdiaspora
Дата:
Сообщение: Re: Visibility of data from table inherits function