Re: create type with %type or %rowtype

From: Adrian Klaver <adrian(dot)klaver(at)aklaver(dot)com>
To: Post Gresql <postgresql(at)taljaren(dot)se>, PostgreSQL General <pgsql-general(at)lists(dot)postgresql(dot)org>
Subject: Re: create type with %type or %rowtype
Date: 2020-11-17 22:51:51
Message-ID: 95489fe2-2beb-2816-bad9-7acc725cfec3@aklaver.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

On 11/17/20 2:12 PM, Post Gresql wrote:
> Hello.
>
> It seems that I can not create a type with
>
> create type my_type as my_table%rowtype;

To me that is redundant as a table has a composite type already.

>
> or
>
> create type my_type as my_table.my_column%type;

In plpgsql %type is effectively a placeholder, not sure how well that
would work in a created type.

>
> Correct? It seems to be a feature for plpgsql programing only, right?
>
> But wouldn't that be a good thing to be able to do? Or would it cause
> too many problems?
>
>
> Best regards
>
>
>
>

--
Adrian Klaver
adrian(dot)klaver(at)aklaver(dot)com

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Rich Shepard 2020-11-17 23:46:58 PK issue: serial sequence needs updating
Previous Message Adrian Klaver 2020-11-17 22:30:44 Re: pg_upgrade from 12 to 13 failes with plpython2