Re: define type_transform to new user defined type - Mailing list pgsql-hackers

From Kyotaro HORIGUCHI
Subject Re: define type_transform to new user defined type
Date
Msg-id 20140227.133123.49256095.horiguchi.kyotaro@lab.ntt.co.jp
Whole thread Raw
In response to Re: define type_transform to new user defined type  (Tom Lane <tgl@sss.pgh.pa.us>)
List pgsql-hackers
Hello,

> Mohsen SM <mohsensoodkhah@gmail.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



pgsql-hackers by date:

Previous
From: Stephen Frost
Date:
Subject: Re: jsonb and nested hstore
Next
From: Noah Misch
Date:
Subject: Re: UNION ALL on partitioned tables won't use indices.