Re: [PATCH] Generate random dates/times in a specified range

Dean Rasheed <dean.a.rasheed@gmail.com>

From: Dean Rasheed <dean.a.rasheed@gmail.com>
To: Greg Sabino Mullane <htamfids@gmail.com>
Cc: Damien Clochard <damien@dalibo.info>, Tom Lane <tgl@sss.pgh.pa.us>, pgsql-hackers@lists.postgresql.org
Date: 2025-07-14T07:21:19Z
Lists: pgsql-hackers

Commits

Same data as JSON: GET /api/v1/messages/:b64id/commits the thread's linked commits as JSON, with link sources. API reference →
  1. doc: Improve description of new random(min, max) functions.

  2. Add date and timestamp variants of random(min, max).

On Sat, 12 Jul 2025 at 16:15, Greg Sabino Mullane <htamfids@gmail.com> wrote:
>
> I like the idea, especially the date variant. Unlike Tom, I'm not particularly concerned about breakage of existing scripts, as
> most already are working just fine with raw numbers and I don't see this patch breaking them.
>
> In a selfish vein, I would use the "date" and timestamp variants a lot. I would use the "time" ones seldom to never.

But it's completely trivial to emulate random(min_date, max_date), just by doing

  min_date + random(0, max_date - min_date)

Is it really worth adding a core function for that?

Regards,
Dean