Re: [PATCH] Introduce array_shuffle() and array_sample()
Martin Kalcher <martin.kalcher@aboutsource.net>
From: Martin Kalcher <martin.kalcher@aboutsource.net>
To: Fabien COELHO <coelho@cri.ensmp.fr>
Cc: Dean Rasheed <dean.a.rasheed@gmail.com>, Tom Lane <tgl@sss.pgh.pa.us>,
Robert Haas <robertmhaas@gmail.com>, Andrew Dunstan <andrew@dunslane.net>,
John Naylor <john.naylor@enterprisedb.com>,
Thomas Munro <thomas.munro@gmail.com>,
PostgreSQL Hackers <pgsql-hackers@lists.postgresql.org>
Date: 2022-07-25T07:34:31Z
Lists: pgsql-hackers, pgsql-general
Attachments
- v2-0001-Introduce-array_shuffle-and-array_sample.patch (text/x-patch) patch v2-0001
Am 24.07.22 um 21:42 schrieb Fabien COELHO: > > Duno. I'm still wondering what it should do. I'm pretty sure that the > documentation should be clear about a shared seed, if any. I do not > think that departing from the standard is a good thing, either. Are sure it violates the standard? I could not find anything about it. The private prng state for random() was introduced in 2018 [0]. Neither commit nor discussion mentions any standard compliance. [0] https://www.postgresql.org/message-id/E1gdNAo-00036g-TB%40gemulon.postgresql.org I updated the documentation for setseed(). > If someone wants a limit, they can easily "LEAST(#1 dim size, other > limit)" to get it, it is easy enough with a strict function. Convinced. It errors out now if n is out of bounds. Martin
Commits
-
Add array_sample() and array_shuffle() functions.
- 888f2ea0a81f 16.0 landed
-
Use a separate random seed for SQL random()/setseed() functions.
- 6645ad6bdd81 12.0 cited