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+bJJby3c3ri_x_fW1-zbByQemtNvdAC1neVGDJaxg_DcDMH3A@mail.gmail.com
Whole thread Raw
In response to Re: Visibility of data from table inherits function  (ourdiaspora <ourdiaspora@protonmail.com>)
List pgsql-general
On Sun, 2 Jan 2022 at 20:42, ourdiaspora <ourdiaspora@protonmail.com> wrote:
> On Sunday, January 2nd, 2022 at 3:54 PM, Francisco Olarte <folarte@peoplecall.com> wrote:
> > Inherits does not copy things. LIKE on creation does, but AFAIK it can
> > copy nearly everything except data.
> Thanks, had read that part of the documentation.
> So far it seems that functions 'joins' may be used to view data, whilst the functions 'views' is unable to be used
withdata entry.
 
> Please, any suggestions of an alternative function to use?

I would first suggest you try to describe what you are trying to
achieve, just to avoid https://xyproblem.info.

If what you want to achieve is copying what is in table PARENT when
you create table CHILD the solution is easy, providing all the extra
columns have DEFAULT values, just use a CREATE LIKE followed by an
INSERT INTO CHILD SELECT * FROM PARENT, it is a simple two liner that
you can wrap in a function if you need to use it a lot in your work
flow.

If you want to see the rows of BOTH when you select from CHILD you
need a VIEW, as PARENT has missing columns.

As you have not stated what you want to achieve, even in the examples,
not much can be suggested, hence the cite of XYproblem.

Francisco Olarte.



pgsql-general by date:

Previous
From: Achilleas Mantzios
Date:
Subject: Re: Visibility of data from table inherits function
Next
From: Yi Sun
Date:
Subject: VACUUM FULL missing chunk number 0 for toast value