Re: Visibility of data from table inherits function - Mailing list pgsql-general

From Francisco Olarte
Subject Re: Visibility of data from table inherits function
Date
Msg-id CA+bJJbwsUtM-fpcPAVcNuPoyGkqwhoSnFTBY8gSBJ5zOKpBdug@mail.gmail.com
Whole thread Raw
In response to Visibility of data from table inherits function  (ourdiaspora <ourdiaspora@protonmail.com>)
Responses Re: Visibility of data from table inherits function  (ourdiaspora <ourdiaspora@protonmail.com>)
List 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 by date:

Previous
From: "David G. Johnston"
Date:
Subject: Re: Visibility of data from table inherits function
Next
From: ourdiaspora
Date:
Subject: Re: Visibility of data from table inherits function