From: | Dean Rasheed <dean(dot)a(dot)rasheed(at)gmail(dot)com> |
---|---|
To: | Vik Fearing <vik(at)postgresfriends(dot)org> |
Cc: | jian he <jian(dot)universality(at)gmail(dot)com>, PostgreSQL-development <pgsql-hackers(at)postgresql(dot)org> |
Subject: | Re: array_random |
Date: | 2025-07-07 07:53:46 |
Message-ID: | CAEZATCUn+fYYROQROtaSvA4v0YnchzjaptSCw+TfukgeSR3_HQ@mail.gmail.com |
Views: | Whole Thread | Raw Message | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-hackers |
On Sat, 5 Jul 2025 at 08:32, Vik Fearing <vik(at)postgresfriends(dot)org> wrote:
>
> On 30/06/2025 17:04, jian he wrote:
>
> reasons for adding array_random is:
> 1. This is better than array_fill. This can fill random and constant
> values (random, min and max the same).
> 2. Building a multi-dimensional PL/pgSQL function equivalent to
> array_random is not efficient and is also not easier.
I took a quick look at this and there are a number of things that I
don't like about the implementation. However, ...
> I am not against this at all, but what is the actual use case?
I think that's a reasonable question to ask.
The original use case [1] was to produce arrays of random numbers for
testing gin indexes.
[1] https://www.postgresql.org/message-id/87plssezpc.fsf%40163.com
However, this is adding quite a lot of C code for something that's
actually pretty easy to do as a user-defined function in SQL. Maybe
that's OK, if it's something that there's a lot of demand for, but
it's worth asking that question.
Regards,
Dean
From | Date | Subject | |
---|---|---|---|
Next Message | Evgeny Voropaev | 2025-07-07 08:17:13 | Re: Add 64-bit XIDs into PostgreSQL 15 |
Previous Message | Richard Guo | 2025-07-07 07:37:54 | Re: Consider explicit incremental sort for Append and MergeAppend |