Proposal: casts row to array and array to row - Mailing list pgsql-hackers

From Pavel Stehule
Subject Proposal: casts row to array and array to row
Date
Msg-id CAFj8pRBOUc8Y2f7qnENCuNFjmC1wwS5z_GpQwWv5OLWqmV=Bvw@mail.gmail.com
Whole thread Raw
Responses Re: Proposal: casts row to array and array to row  (Robert Haas <robertmhaas@gmail.com>)
Re: Proposal: casts row to array and array to row  (Merlin Moncure <mmoncure@gmail.com>)
Re: Proposal: casts row to array and array to row  (Noah Misch <noah@leadboat.com>)
List pgsql-hackers
Hello

A current limits of dynamic work with row types in PL/pgSQL can be
decreased with a possible casts between rows and arrays. Now we have a
lot of tools for arrays, and these tools should be used for rows too.

postgres=# \d mypoint
Composite type "public.mypoint"Column │  Type   │ Modifiers
────────┼─────────┼───────────a      │ integer │b      │ integer │

postgres=# select cast(rmypoint '(10,20) as int[]);  array
────────────{10,20}
(1 row)

postgres=# select cast(ARRAY[10,20] AS mypoint);mypoint
─────────(10,20)
(1 row)

What do you think about this idea?

Regards

Pavel Stehule

pgsql-hackers by date:

Previous
From: Kyotaro HORIGUCHI
Date:
Subject: Re: [v9.2] make_greater_string() does not return a string in some cases
Next
From: Jun Ishiduka
Date:
Subject: Re: Online base backup from the hot-standby