Re: [PATCH] Introduce array_shuffle() and array_sample()
Joe Conway <mail@joeconway.com>
From: Joe Conway <mail@joeconway.com>
To: Tom Lane <tgl@sss.pgh.pa.us>, Robert Haas <robertmhaas@gmail.com>
Cc: Andrew Dunstan <andrew@dunslane.net>,
Martin Kalcher <martin.kalcher@aboutsource.net>,
John Naylor <john.naylor@enterprisedb.com>,
Thomas Munro <thomas.munro@gmail.com>,
PostgreSQL Hackers <pgsql-hackers@lists.postgresql.org>
Date: 2022-07-22T16:49:10Z
Lists: pgsql-hackers, pgsql-general
On 7/19/22 10:20, Tom Lane wrote: > Everything else either explicitly rejects more-than-one-D arrays > or does something that is compatible with thinking of them as > arrays-of-arrays. I think I am responsible for at least some of those, and I agree that thinking of MD arrays as arrays-of-arrays is preferable even though they are not actually that. Long ago[1] Peter E asked me to fix that as I recall but it was one of those round tuits that I never found. > So I withdraw my original position. These functions should just > shuffle or select in the array's first dimension, preserving > subarrays. Or else be lazy and reject more-than-one-D arrays; > but it's probably not that hard to handle them. +1 Joe [1] https://www.postgresql.org/message-id/flat/Pine.LNX.4.44.0306281418020.2178-100000%40peter.localdomain#a064d6dd8593993d799db453a3ee04d1 -- Joe Conway RDS Open Source Databases Amazon Web Services: https://aws.amazon.com
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