Convert text to user defined datatype - Mailing list pgsql-sql

From aditya desai
Subject Convert text to user defined datatype
Date
Msg-id CAN0SRDFsxNhWMOdSj_gveb3=7E6ktRR_q1Masr6EmiLGg5J53A@mail.gmail.com
Whole thread Raw
Responses RE: Convert text to user defined datatype
List pgsql-sql
Hi,
I have a user defined data type as below.

postgres=# \d  t2;
                    Composite type "public.t2"
 Column |          Type           | Collation | Nullable | Default
--------+-------------------------+-----------+----------+---------
 t2     | character varying(30)[] |           |          |


I need to cast values to the above type. Getting error below.

postgres=# CREATE CAST (text as t2) without function;
ERROR:  source and target data types are not physically compatible

If I have to create a CAST with function. Could you please suggest how to write this function?

Regards,
Aditya.




pgsql-sql by date:

Previous
From: "David G. Johnston"
Date:
Subject: Re: create a procedure based on column data change in postgrersql
Next
From: "Voillequin, Jean-Marc"
Date:
Subject: RE: Convert text to user defined datatype