Thread

  1. Re: Avoiding roundoff error in pg_sleep()

    David G. Johnston <david.g.johnston@gmail.com> — 2025-09-26T15:32:46Z

    On Friday, September 26, 2025, Vladlen Popolitov <v.popolitov@postgrespro.ru>
    wrote:
    
    > 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.
    >
    
    That is not reality.  And as noted, any similar reality is not only
    manifested by using this function.
    
    You are going to need to construct a test case demonstrating your concerns,
    which will likely alleviate them instead.  Or, at least, let you accept
    that once you’ve given someone a login to your database they can indeed
    perform a DoS on it if you haven’t taken appropriate precautions with
    timeouts and such.
    
    David J.