From: | Aleksander Alekseev <aleksander(at)timescale(dot)com> |
---|---|
To: | Postgres hackers <pgsql-hackers(at)lists(dot)postgresql(dot)org> |
Cc: | Dean Rasheed <dean(dot)a(dot)rasheed(at)gmail(dot)com>, Andy Fan <zhihuifan1213(at)163(dot)com>, Japin Li <japinli(at)hotmail(dot)com>, Jim Jones <jim(dot)jones(at)uni-muenster(dot)de> |
Subject: | Re: New function normal_rand_array function to contrib/tablefunc. |
Date: | 2024-11-05 15:22:50 |
Message-ID: | CAJ7c6TOhwhK1=s9mwaSQy2jWvban1OZ4rz7_pLCvb+NbdiQ6Wg@mail.gmail.com |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-hackers |
Hi Dean,
Thanks for your input.
> > 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}
> > ...
> >
>
> Yeah, that looks like a neater API.
>
> Something that bothers me somewhat is that it's completely trivial for
> the user to write such a function for themselves, so is it really
> useful enough to include in core?
I think it would be useful. Many users don't bother writing C
extensions for tasks like this. So at least our implementation is
going to be faster.
> The other question is whether it's an array function or a random
> function. I.e., should it be listed in "Table 9.55. Array Functions",
> in which case the name array_random() makes sense, or should it be
> listed in "Table 9.6. Random Functions", in which case it should
> probably be called random_array(). I think the latter makes more
> sense, since it's a function that generates random values, more
> similar to the random(min, max) functions. Also I think it's more
> useful if it shares the same PRNG, controlled by setseed(), and it
> makes sense to group all such functions together.
Good point. Personally I don't have a strong opinion on whether
random_array() or array_random() is preferable, for me either option
is OK. Perhaps we should cross-reference the function between two
sections of the documentation to make it easier to find.
--
Best regards,
Aleksander Alekseev
From | Date | Subject | |
---|---|---|---|
Next Message | Dave Page | 2024-11-05 15:27:03 | Re: doc: pgevent.dll location |
Previous Message | Tom Lane | 2024-11-05 15:15:48 | Re: doc: pgevent.dll location |