Re: create type with %type or %rowtype - Mailing list pgsql-general

From Adrian Klaver
Subject Re: create type with %type or %rowtype
Date
Msg-id 95489fe2-2beb-2816-bad9-7acc725cfec3@aklaver.com
Whole thread Raw
In response to create type with %type or %rowtype  (Post Gresql <postgresql@taljaren.se>)
List 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.klaver@aklaver.com



pgsql-general by date:

Previous
From: Adrian Klaver
Date:
Subject: Re: pg_upgrade from 12 to 13 failes with plpython2
Next
From: Rich Shepard
Date:
Subject: PK issue: serial sequence needs updating