Re: array_random
От | Aleksander Alekseev |
---|---|
Тема | Re: array_random |
Дата | |
Msg-id | CAJ7c6TMaEstEeHx-6H0T4zqoO+5=iCVma6YCt0btmLxFRFbYew@mail.gmail.com обсуждение исходный текст |
Ответ на | Re: array_random (jian he <jian.universality@gmail.com>) |
Ответы |
Re: array_random
|
Список | pgsql-hackers |
Hi, > it seems not trivial to wrap up all the generated random values into a specific > multi-dimensional array (more than 2 dimensions). > for example, say we generated 24 random values and wanted to arrange them into a > 3-dimensional array with shape [4, 3, 2]. > we can easily use: > SELECT array_random(1, 6, array[4,3, 2]); > > of course, we can use plpgsql to do it, but the c function would be > more convenient. > does this make sense? The proposed function seems to do two things at a time - generating random values and transforming them into an array of desired dimensions. Generally we try to avoid such interfaces. Can you think of something like array_transform() / array_reshape() that takes an arbitrary single-dimension array and modifies it?
В списке pgsql-hackers по дате отправления: