Re: Visibility of data from table inherits function

From: Francisco Olarte <folarte(at)peoplecall(dot)com>
To: ourdiaspora <ourdiaspora(at)protonmail(dot)com>
Cc: "pgsql-general(at)lists(dot)postgresql(dot)org" <pgsql-general(at)lists(dot)postgresql(dot)org>
Subject: Re: Visibility of data from table inherits function
Date: 2022-01-03 08:04:22
Message-ID: CA+bJJby3c3ri_x_fW1-zbByQemtNvdAC1neVGDJaxg_DcDMH3A@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

On Sun, 2 Jan 2022 at 20:42, ourdiaspora <ourdiaspora(at)protonmail(dot)com> wrote:
> On Sunday, January 2nd, 2022 at 3:54 PM, Francisco Olarte <folarte(at)peoplecall(dot)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 with data 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.

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Yi Sun 2022-01-03 09:28:49 VACUUM FULL missing chunk number 0 for toast value
Previous Message Achilleas Mantzios 2022-01-02 21:37:04 Re: Visibility of data from table inherits function