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

Поиск
Список
Период
Сортировка
От Greg Sabino Mullane
Тема Re: [PATCH] Generate random dates/times in a specified range
Дата
Msg-id CAKAnmmJb54X65PjeccHgrec_mCiubHrjTS7LtCpwOtxscR21eA@mail.gmail.com
обсуждение исходный текст
Ответ на Re: [PATCH] Generate random dates/times in a specified range  (Dean Rasheed <dean.a.rasheed@gmail.com>)
Ответы Re: [PATCH] Generate random dates/times in a specified range
Список pgsql-hackers
On Mon, Jul 14, 2025 at 3:21 AM Dean Rasheed <dean.a.rasheed@gmail.com> 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 random int from 50 to 100 with

50 + floor(random() * 51)

but random(50,100) is so much nicer.

Cheers,
Greg

--
Enterprise Postgres Software Products & Tech Support

В списке pgsql-hackers по дате отправления: