Re: Visibility of data from table inherits function

Поиск
Список
Период
Сортировка
От Francisco Olarte
Тема Re: Visibility of data from table inherits function
Дата
Msg-id CA+bJJby3c3ri_x_fW1-zbByQemtNvdAC1neVGDJaxg_DcDMH3A@mail.gmail.com
обсуждение исходный текст
Ответ на Re: Visibility of data from table inherits function  (ourdiaspora <ourdiaspora@protonmail.com>)
Список 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 по дате отправления:

Предыдущее
От: Achilleas Mantzios
Дата:
Сообщение: Re: Visibility of data from table inherits function
Следующее
От: Yi Sun
Дата:
Сообщение: VACUUM FULL missing chunk number 0 for toast value