Convert text to user defined datatype

From: aditya desai <admad123(at)gmail(dot)com>
To: pgsql-sql <pgsql-sql(at)lists(dot)postgresql(dot)org>
Subject: Convert text to user defined datatype
Date: 2021-10-23 09:40:28
Message-ID: CAN0SRDFsxNhWMOdSj_gveb3=7E6ktRR_q1Masr6EmiLGg5J53A@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: 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.

Responses

Browse pgsql-sql by date

  From Date Subject
Next Message Voillequin, Jean-Marc 2021-10-23 14:18:42 RE: Convert text to user defined datatype
Previous Message Ninad Shah 2021-10-22 14:41:17 Re: Query out of memory