Thread

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

    Robert Treat <rob@xzilla.net> — 2025-07-15T03:48:50Z

    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