Re: inherits clause for CREATE TYPE? -

Поиск
Список
Период
Сортировка
От Merlin Moncure
Тема Re: inherits clause for CREATE TYPE? -
Дата
Msg-id CAHyXU0xUROq8tyj4B6V09mFP1S0kN2Lzeg7an4Nd2WQ1rjn1UA@mail.gmail.com
обсуждение исходный текст
Ответ на inherits clause for CREATE TYPE? -  (Pavel Stehule <pavel.stehule@gmail.com>)
Ответы Re: inherits clause for CREATE TYPE? -  (Pavel Stehule <pavel.stehule@gmail.com>)
Список pgsql-hackers
On Wed, Dec 18, 2019 at 12:38 PM Pavel Stehule <pavel.stehule@gmail.com> wrote:
>
> Hi
>
> I had a talk with one boy about development in plpgsql. He uses table's functions. More times he uses returns types
basedon some table type + few attributes. Now he use a ugly hack - he create a view on table plus some columns - and
thenhe use the view related type as table function result type. For similar uses cases there can be interesting to have
apossibility to create types by extending other types. Probably almost all functionality is inside now - so it should
notbe hard work. 
>
> My idea is implement inherits clause for CREATE TYPE command.
>
> Some like
>
> CREATE TYPE fx_rt (xx int) INHERITS(pg_class);
>
> What do you think about this idea?

How about using composition style approaches?

create type base as (...)

create type extended as  (b base, ...)

create function foo() returns extended as ...

merlin



В списке pgsql-hackers по дате отправления:

Предыдущее
От: Vladimir Koković
Дата:
Сообщение: Re: Restore backup file "with oids"
Следующее
От: Ranier Vf
Дата:
Сообщение: [PATCH] remove expression always false