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

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

Greg Sabino Mullane <htamfids(at)gmail(dot)com> writes:
> On Mon, Jul 14, 2025 at 3:21 AM Dean Rasheed <dean(dot)a(dot)rasheed(at)gmail(dot)com>
> wrote:
>> Is it really worth adding a core function for that?

> Yes, I think it is. It is also trivial to get a random int from 50 to 100
> with
> 50 + floor(random() * 51)
> but random(50,100) is so much nicer.

I won't object to adding this for date/timestamp/timestamptz, but
I don't really believe that the time/timetz variants are worth the
code space. I think the latter two would also have definitional
issues because of the modulo behavior of those types' underlying
arithmetic.

regards, tom lane

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Tom Lane 2025-07-15 15:11:26 Re: remove WITHOUT OIDS syntax for v19
Previous Message Fujii Masao 2025-07-15 15:08:13 Re: Logical replication launcher did not automatically restart when got SIGKILL