Search Postgresql Archives

Re: Visibility of data from table inherits function

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Sun, 2 Jan 2022 at 13:23, ourdiaspora <ourdiaspora@xxxxxxxxxxxxxx> 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.





[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Index of Archives]     [Postgresql Jobs]     [Postgresql Admin]     [Postgresql Performance]     [Linux Clusters]     [PHP Home]     [PHP on Windows]     [Kernel Newbies]     [PHP Classes]     [PHP Databases]     [Postgresql & PHP]     [Yosemite]

  Powered by Linux