Re: Assign User Defined DataType To Columns - Mailing list pgsql-admin

From David G. Johnston
Subject Re: Assign User Defined DataType To Columns
Date
Msg-id CAKFQuwYa6PDMPb8DjL+zQnEJYaOz-3mYa8uKbBpgO6ttsmMWAg@mail.gmail.com
Whole thread Raw
In response to analyze foreign tables  (richard coleman <rcoleman.ascentgl@gmail.com>)
List pgsql-admin
Seriously, you sent this to three lists at the same time?  I'm surprised it came through moderation...

Anyway, my response on the admin list is below - though none of the lists you picked were actually the appropriate one.  You want the -general list.

On Wed, Aug 2, 2023 at 9:42 AM David G. Johnston <david.g.johnston@gmail.com> wrote:
On Wed, Aug 2, 2023 at 9:24 AM Phani Prathyush Somayajula <phani.somayajula@pragmaticplay.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.

pgsql-admin by date:

Previous
From: "David G. Johnston"
Date:
Subject: Re: Assign User Defined DataType To Columns
Next
From: Chris Hoover
Date:
Subject: Anyway to index array with other columns