pg.ddx.io  pgsql-general@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Adrian Klaver <adrian.klaver@aklaver.com>
To: Post Gresql <postgresql@taljaren.se>
To: PostgreSQL General <pgsql-general@lists.postgresql.org>
Subject: Re: create type with %type or %rowtype
Date: Tue, 17 Nov 2020 14:51:51 -0800
Message-ID: <95489fe2-2beb-2816-bad9-7acc725cfec3@aklaver.com> (raw)
In-Reply-To: <4fb49f43-6753-b692-9ca7-61052f63a929@taljaren.se>
References: <4fb49f43-6753-b692-9ca7-61052f63a929@taljaren.se>

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





view thread (11+ messages)  latest in thread

Message-ID: <95489fe2-2beb-2816-bad9-7acc725cfec3@aklaver.com>
Permalink:  ../95489fe2-2beb-2816-bad9-7acc725cfec3@aklaver.com/
Also on:    postgresql.org/message-id/95489fe2-2beb-2816-bad9-7acc725cfec3@aklaver.com

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients from your mail client; the link fills in
  the headers below: reply via email
  Some clients, webmail especially, drop In-Reply-To and References from
  a link, and the reply then starts a new thread: use the mbox below.

  To: pgsql-general@postgresql.org
  Cc: adrian.klaver@aklaver.com, postgresql@taljaren.se
  Subject: Re: create type with %type or %rowtype
  In-Reply-To: <95489fe2-2beb-2816-bad9-7acc725cfec3@aklaver.com>
  References: <4fb49f43-6753-b692-9ca7-61052f63a929@taljaren.se> <95489fe2-2beb-2816-bad9-7acc725cfec3@aklaver.com>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox