Re: Proposal to introduce a shuffle function to intarray extension

From: Martin Kalcher <martin(dot)kalcher(at)aboutsource(dot)net>
To: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Cc: Thomas Munro <thomas(dot)munro(at)gmail(dot)com>, PostgreSQL Hackers <pgsql-hackers(at)lists(dot)postgresql(dot)org>
Subject: Re: Proposal to introduce a shuffle function to intarray extension
Date: 2022-07-17 23:05:19
Message-ID: 5b7a1ee9-f942-2502-3a0c-e9fc12511139@aboutsource.net
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general pgsql-hackers

Am 18.07.22 um 00:46 schrieb Tom Lane:
>
> This does not look particularly idiomatic, or even type-safe. What you
> should have done was use deconstruct_array to get an array of Datums and
> isnull flags, then shuffled those, then used construct_array to build the
> output.
>
> (Or, perhaps, use construct_md_array to replicate the input's
> precise dimensionality. Not sure if anyone would care.)
>
> regards, tom lane

deconstruct_array() would destroy the arrays dimensions. I would expect
that shuffle() only shuffles the first dimension and keeps the inner
arrays intact.

Martin

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Martin Kalcher 2022-07-17 23:07:22 Re: Proposal to introduce a shuffle function to intarray extension
Previous Message Tom Lane 2022-07-17 22:53:31 Re: Proposal to introduce a shuffle function to intarray extension

Browse pgsql-hackers by date

  From Date Subject
Next Message Dian M Fay 2022-07-17 23:07:15 Re: doc: Make selectivity example match wording
Previous Message Tom Lane 2022-07-17 22:53:31 Re: Proposal to introduce a shuffle function to intarray extension