Re: define type_transform to new user defined type

From: Kyotaro HORIGUCHI <horiguchi(dot)kyotaro(at)lab(dot)ntt(dot)co(dot)jp>
To: tgl(at)sss(dot)pgh(dot)pa(dot)us
Cc: mohsensoodkhah(at)gmail(dot)com, pgsql-hackers(at)postgresql(dot)org
Subject: Re: define type_transform to new user defined type
Date: 2014-02-27 04:31:23
Message-ID: 20140227.133123.49256095.horiguchi.kyotaro@lab.ntt.co.jp
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Hello,

> Mohsen SM <mohsensoodkhah(at)gmail(dot)com> writes:
> I want to create new type that is similar to varchar.
> its size is variable.
> I use CREATE TYPE query.
> I define for that type this functions:
> 1-typein
> 2-typeoute
> 3-typemodify_input
> 4-typemodify_output
> 5-type_transform
> I can define 1 to 4 functions in CREATE TYPE
> but I can't define type_transform for that type. how did I can define
> type_transform for that type?

"type cast" came in my mind seeing "type transoform" among
them. You could do that by using 'CREATE CAST' if this is right.

http://www.postgresql.org/docs/current/static/sql-createcast.html

At Tue, 25 Feb 2014 16:11:46 -0500, Tom Lane wrote
> There's no such thing as a "type transform". There are transforms
> associated with functions ... unfortunately, there's not currently
> any provision for defining those at the SQL level. You could poke
> an entry into pg_proc.protransform if you're desperate enough.

Just for curiosity but could I have some examples for transforms
associated with functions? I saw a lot of "transform"s for
clauses, exprs, plan nodes, etc, but I had nothing so grepping
src/backend/* for 'transform'.

regards,

--
Kyotaro Horiguchi
NTT Open Source Software Center

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Ashutosh Bapat 2014-02-27 04:55:54 Re: Avoiding deeply nested AND/OR trees in the parser
Previous Message Noah Misch 2014-02-27 04:29:35 Re: UNION ALL on partitioned tables won't use indices.