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

From: Martin Kalcher <martin(dot)kalcher(at)aboutsource(dot)net>
To: Fabien COELHO <coelho(at)cri(dot)ensmp(dot)fr>
Cc: Dean Rasheed <dean(dot)a(dot)rasheed(at)gmail(dot)com>, Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>, Robert Haas <robertmhaas(at)gmail(dot)com>, Andrew Dunstan <andrew(at)dunslane(dot)net>, John Naylor <john(dot)naylor(at)enterprisedb(dot)com>, Thomas Munro <thomas(dot)munro(at)gmail(dot)com>, PostgreSQL Hackers <pgsql-hackers(at)lists(dot)postgresql(dot)org>
Subject: Re: [PATCH] Introduce array_shuffle() and array_sample()
Date: 2022-07-25 07:34:31
Message-ID: fe7a6a81-5c1b-aaae-922f-cb86be324373@aboutsource.net
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general pgsql-hackers

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

Attachment Content-Type Size
v2-0001-Introduce-array_shuffle-and-array_sample.patch text/x-patch 17.7 KB

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Alicja Kucharczyk 2022-07-25 08:17:05 Re: Was my question inappropriate for postgres?
Previous Message Amit Kapila 2022-07-25 06:13:36 Re: Support logical replication of DDLs

Browse pgsql-hackers by date

  From Date Subject
Next Message Pierre Ducroquet 2022-07-25 07:37:52 log_line_prefix: make it possible to add the search_path
Previous Message Peter Smith 2022-07-25 07:28:40 Re: Handle infinite recursion in logical replication setup