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

Martin Kalcher <martin.kalcher@aboutsource.net>

From: Martin Kalcher <martin.kalcher@aboutsource.net>
To: Tom Lane <tgl@sss.pgh.pa.us>, Fabien COELHO <coelho@cri.ensmp.fr>
Cc: Andres Freund <andres@anarazel.de>, Dean Rasheed <dean.a.rasheed@gmail.com>, 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-09-29T09:39:28Z
Lists: pgsql-hackers, pgsql-general

Attachments

Am 28.09.22 um 16:18 schrieb Tom Lane:
> It is seeded at process start, yes.  If you don't feel a need for
> user control over the sequence used by these functions, then using
> pg_global_prng_state is fine.  (Basically the point to be made
> here is that we need to keep a tight rein on what can be affected
> by setseed().)
> 
> 			regards, tom lane

New patch: array_shuffle() and array_sample() use pg_global_prng_state now.

Martin

Commits

  1. Add array_sample() and array_shuffle() functions.

  2. Use a separate random seed for SQL random()/setseed() functions.