Re: [PATCH] Introduce array_shuffle() and array_sample()

From: Martin Kalcher <martin(dot)kalcher(at)aboutsource(dot)net>
To: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Cc: Robert Haas <robertmhaas(at)gmail(dot)com>, John Naylor <john(dot)naylor(at)enterprisedb(dot)com>, Thomas Munro <thomas(dot)munro(at)gmail(dot)com>, PostgreSQL Hackers <pgsql-hackers(at)lists(dot)postgresql(dot)org>
Subject: Re: [PATCH] Introduce array_shuffle() and array_sample()
Date: 2022-07-18 22:52:47
Message-ID: f291e91b-34d0-6711-b32d-4c90a40c347c@aboutsource.net
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general pgsql-hackers

Am 19.07.22 um 00:18 schrieb Tom Lane:
>
> Independently of the dimensionality question --- I'd imagined that
> array_sample would select a random subset of the array elements
> but keep their order intact. If you want the behavior shown
> above, you can do array_shuffle(array_sample(...)). But if we
> randomize it, and that's not what the user wanted, she has no
> recourse.
>
> Now, if you're convinced that the set of people wanting
> sampling-without-shuffling is the empty set, then making everybody
> else call two functions is a loser. But I'm not convinced.
> At the least, I'd like to see the argument made why nobody
> would want that.
>

On the contrary! I am pretty sure there are people out there wanting
sampling-without-shuffling. I will think about that.

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Thomas Munro 2022-07-19 01:09:12 Re: [PATCH] Introduce array_shuffle() and array_sample()
Previous Message Tom Lane 2022-07-18 22:43:32 Re: [PATCH] Introduce array_shuffle() and array_sample()

Browse pgsql-hackers by date

  From Date Subject
Next Message Jacob Champion 2022-07-18 22:53:25 Re: Commitfest Update
Previous Message Tom Lane 2022-07-18 22:43:32 Re: [PATCH] Introduce array_shuffle() and array_sample()