Re: array_random - Mailing list pgsql-hackers

From jian he
Subject Re: array_random
Date
Msg-id CACJufxH89EiwapAfOQOqMMQWw11RYb=N68N=BF17KJ7x=O9dFQ@mail.gmail.com
Whole thread Raw
List pgsql-hackers
On Mon, Jun 30, 2025 at 11:04 PM jian he <jian.universality@gmail.com> wrote:
>
> demo:
> SELECT array_random(1, 6, array[2,5], array[2,4]);
>              array_random
> --------------------------------------
>  [2:3][4:8]={{6,2,2,5,4},{4,5,6,4,6}}
>
> 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.
>
> [1] https://www.postgresql.org/message-id/CACJufxGRCP19Rm66%3DTSBwmEuVr92FwL_e6YFjmCpJrgu6Km9hQ%40mail.gmail.com

i didn't use ./src/include/catalog/duplicate_oids
then there is some duplicated oid issue.
the attached patch fixes this issue.

Attachment

pgsql-hackers by date:

Previous
From: Noah Misch
Date:
Subject: walwriter can set XLP_BKP_REMOVABLE wrongly: race w/ backup start
Next
From: Noah Misch
Date:
Subject: Re: Get rid of WALBufMappingLock