Re: [PATCH] Generate random dates/times in a specified range - Mailing list pgsql-hackers

From Robert Treat
Subject Re: [PATCH] Generate random dates/times in a specified range
Date
Msg-id CABV9wwPE6K2Duhc0VVXXCt8PSfzJuHJKdGxZTUkb-FPnVcGm4Q@mail.gmail.com
Whole thread Raw
In response to Re: [PATCH] Generate random dates/times in a specified range  (Dean Rasheed <dean.a.rasheed@gmail.com>)
Responses Re: [PATCH] Generate random dates/times in a specified range
List pgsql-hackers
On Mon, Jul 14, 2025 at 3:21 AM Dean Rasheed <dean.a.rasheed@gmail.com> wrote:
> 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?
>

I feel like this is a very similar argument against what was
ultimately the addition of timestamp based generate_series functions,
and similarly I think adding these in would be a rather useful
improvement for users, though like generate_series, we don't need to
hit every different data type (no one should ever generate a random
timetz for instance).


Robert Treat
https://xzilla.net



pgsql-hackers by date:

Previous
From: Tom Lane
Date:
Subject: Re: ScanKeys passed to table_beginscan in SeqNext
Next
From: jian he
Date:
Subject: Re: speedup COPY TO for partitioned table.