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

2025-07-15 Thread Tom Lane
Greg Sabino Mullane writes: > On Mon, Jul 14, 2025 at 3:21 AM Dean Rasheed > 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'

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

2025-07-15 Thread Greg Sabino Mullane
On Mon, Jul 14, 2025 at 3:21 AM Dean Rasheed wrote: > 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? > Yes, I think it is. It is also trivial to get a rando

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

2025-07-15 Thread Dean Rasheed
On Tue, 15 Jul 2025 at 04:49, Robert Treat wrote: > > On Mon, Jul 14, 2025 at 3:21 AM Dean Rasheed wrote: > > > > 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 func

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

2025-07-14 Thread Robert Treat
On Mon, Jul 14, 2025 at 3:21 AM Dean Rasheed wrote: > On Sat, 12 Jul 2025 at 16:15, Greg Sabino Mullane 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 r

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

2025-07-14 Thread Dean Rasheed
On Sat, 12 Jul 2025 at 16:15, Greg Sabino Mullane 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

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

2025-07-12 Thread Greg Sabino Mullane
Patch review OVERALL: 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 timest

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

2025-07-11 Thread Damien Clochard
Le 10.07.2025 00:14, Tom Lane a écrit : Damien Clochard writes: So this adds 5 new variants of the random() function: random(min date, max date) returns date random(min time, max time) returns time random(min time, max time, zone text) returns timetz random(min timestamp,

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

2025-07-09 Thread Tom Lane
Damien Clochard writes: > So this adds 5 new variants of the random() function: > random(min date, max date) returns date > random(min time, max time) returns time > random(min time, max time, zone text) returns timetz > random(min timestamp, max timestamp) returns timestamp >

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

2025-07-09 Thread Damien Clochard
Hello, As I am involved in the PostgreSQL Anonymizer extension, I found that the random(min,max) functions introduced recently are very useful to generate synthetic data or define a masking policy. I decided to submit a similar set of functions for random dates and times. So this adds 5 ne