Re: array_random - Mailing list pgsql-hackers

From Dean Rasheed
Subject Re: array_random
Date
Msg-id CAEZATCU8s3M2R6LALz6aZL_4bVSoDk_zwZ52JjM=t6dXSJCh3g@mail.gmail.com
Whole thread Raw
In response to Re: array_random  (Aleksander Alekseev <aleksander@tigerdata.com>)
List pgsql-hackers
On Tue, 8 Jul 2025 at 15:26, Aleksander Alekseev
<aleksander@tigerdata.com> wrote:
>
> The proposed function seems to do two things at a time - generating
> random values and transforming them into an array of desired
> dimensions. Generally we try to avoid such interfaces. Can you think
> of something like array_transform() / array_reshape() that takes an
> arbitrary single-dimension array and modifies it?

That's a good point. Arguably, creating a simple 1-D array of random
values is trivial enough to leave to users, and there isn't sufficient
demand to justify creating core functions for it.

OTOH, creating multi-dimensional arrays (of any values, not just
random) is harder. Perhaps there is an argument for in-core functions
to make that easier, though I'm not sure how many people actually use
multi-dimensional arrays. In any case, that seems like a separate
discussion for a new thread, if there's demand.

Regards,
Dean



pgsql-hackers by date:

Previous
From: Dean Rasheed
Date:
Subject: Re: Fix replica identity checks for MERGE command on published table.
Next
From: Amit Langote
Date:
Subject: track needed attributes in plan nodes for executor use