Re: Avoiding roundoff error in pg_sleep()
Vladlen Popolitov <v.popolitov@postgrespro.ru>
From: Vladlen Popolitov <v.popolitov@postgrespro.ru>
To: "David G. Johnston" <david.g.johnston@gmail.com>
Cc: Tom Lane <tgl@sss.pgh.pa.us>, pgsql-hackers@lists.postgresql.org
Date: 2025-09-26T15:25:09Z
Lists: pgsql-hackers
Hi David, David G. Johnston писал(а) 2025-09-26 18:08: > On Friday, September 26, 2025, Vladlen Popolitov > <v.popolitov@postgrespro.ru> wrote: > >> It looks like sleep has the wrong place in a function. It should be >> an utility command, that does not start a transaction. > > Then write that command. We’re not going to change pg_sleep. > It’s works just as advertised. It _does_ not work as it advertised. Help page states: 1) "delay execution of the server process" 2) "pg_sleep makes the current session's process sleep" In reality it stops other backends too. > True, it probably should never be > used in production. yes, it should not be used, if you know, but even advanced users do not know the effect of this function. And it can be used by any user of the server. I just pointed attention, that this function could have bigger problem with high values of parameter, not only very small, if you consider problem with small value is really problem. -- Best regards, Vladlen Popolitov.
Commits
-
Try to avoid floating-point roundoff error in pg_sleep().
- 02c4bc88302a 19 (unreleased) landed