Re: Proposal: casts row to array and array to row
От | Merlin Moncure |
---|---|
Тема | Re: Proposal: casts row to array and array to row |
Дата | |
Msg-id | CAHyXU0z0KB9LXpt7kr-MPj9mkzbo-ufx6uBe=WpGXagrLJzdUg@mail.gmail.com обсуждение исходный текст |
Ответ на | Proposal: casts row to array and array to row (Pavel Stehule <pavel.stehule@gmail.com>) |
Ответы |
Re: Proposal: casts row to array and array to row
|
Список | pgsql-hackers |
On Tue, Oct 11, 2011 at 3:40 AM, Pavel Stehule <pavel.stehule@gmail.com> wrote: > 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? Not sure what it buys you over the syntax we already have: select row(foo[1], bar[2]); select array[(bar).a, (bar).b]; Also, in my coding of composite types, homogeneously typed rows don't really come up that often... merlin
В списке pgsql-hackers по дате отправления: