Re: Assign User Defined DataType To Columns

From: "David G(dot) Johnston" <david(dot)g(dot)johnston(at)gmail(dot)com>
To: Phani Prathyush Somayajula <phani(dot)somayajula(at)pragmaticplay(dot)com>
Cc: Pgsql-admin <pgsql-admin(at)lists(dot)postgresql(dot)org>, "pgadmin-hackers(at)postgresql(dot)org" <pgadmin-hackers(at)postgresql(dot)org>, pgAdmin Support <pgadmin-support(at)postgresql(dot)org>
Subject: Re: Assign User Defined DataType To Columns
Date: 2023-08-02 16:42:20
Message-ID: CAKFQuwYXZF7dnmOk2_EPx0aYx-ND8-iJeQG=ioyu24mfRiK-mg@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgadmin-hackers pgadmin-support pgsql-admin

On Wed, Aug 2, 2023 at 9:24 AM Phani Prathyush Somayajula <
phani(dot)somayajula(at)pragmaticplay(dot)com> wrote:

> Hi All,
>
>
>
> I’ve a user defined data type as :
>
> CREATE TYPE uibackend."_operation" (
>

If you find yourself writing user-space code that uses "_{data type}" you
are doing something wrong. That implementation detail is not something
that is exposed to the user. If you want to deal with arrays of a type you
say: {data type}[]

So casting some random text column to an array of operation is simply:

operation_text_col::operation[]

And you can get rid of the above CREATE TYPE command altogether.

David J.

In response to

Responses

Browse pgadmin-hackers by date

  From Date Subject
Next Message David G. Johnston 2023-08-02 16:50:41 Re: Assign User Defined DataType To Columns
Previous Message Phani Prathyush Somayajula 2023-08-02 13:51:17 Assign User Defined DataType To Columns

Browse pgadmin-support by date

  From Date Subject
Next Message David G. Johnston 2023-08-02 16:50:41 Re: Assign User Defined DataType To Columns
Previous Message Phani Prathyush Somayajula 2023-08-02 13:51:17 Assign User Defined DataType To Columns

Browse pgsql-admin by date

  From Date Subject
Next Message David G. Johnston 2023-08-02 16:50:41 Re: Assign User Defined DataType To Columns
Previous Message Phani Prathyush Somayajula 2023-08-02 13:51:17 Assign User Defined DataType To Columns