Hi, > I played with patch v3. All in all it seems to be in good shape. > > I wonder though whether tablefunc extension is the right place for the > function. To me it seems to be as useful as array_shuffle(). > > Personally I would name the function array_rand() in order to be > consistent with the rest of array_* functions [1]. > > I would also replace `minlen` and `maxlen` arguments with a single > `len` argument because the same result (although more slowly) can be > achieved like this: > > SELECT trim_array(arr, random(0,3)) FROM rand_array(10, 3, 3, 50::int, > 80::int) as arr; > > This could be just a bike-shedding though. Does anyone feel necessary > to second any of these nitpicks? > > [1]: https://www.postgresql.org/docs/current/functions-array.html
On second thought, is there really much value in returning a setof? Any reason not to have an interface as simple and straightforward as this: ``` =# SELECT array_random(1, 10, random(0, 3)) FROM generate_series( ... ) {5} {1, 3, 8} {7, 6} ... ``` ? Or maybe I'm missing something? -- Best regards, Aleksander Alekseev