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

From: Dean Rasheed <dean(dot)a(dot)rasheed(at)gmail(dot)com>
To: Greg Sabino Mullane <htamfids(at)gmail(dot)com>
Cc: Damien Clochard <damien(at)dalibo(dot)info>, Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>, pgsql-hackers(at)lists(dot)postgresql(dot)org
Subject: Re: [PATCH] Generate random dates/times in a specified range
Date: 2025-07-14 07:21:19
Message-ID: CAEZATCU+Q6uz8RPck9WEWAOwNsNrEv_LQtx2Gqz83ghJ4dG7Sg@mail.gmail.com
Views: Whole Thread | Raw Message | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On Sat, 12 Jul 2025 at 16:15, Greg Sabino Mullane <htamfids(at)gmail(dot)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

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Andrei Lepikhov 2025-07-14 08:04:01 Re: track needed attributes in plan nodes for executor use
Previous Message Masahiko Sawada 2025-07-14 07:09:39 Re: POC: Parallel processing of indexes in autovacuum