Re: Avoiding roundoff error in pg_sleep()

From: "David G(dot) Johnston" <david(dot)g(dot)johnston(at)gmail(dot)com>
To: Vladlen Popolitov <v(dot)popolitov(at)postgrespro(dot)ru>
Cc: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>, "pgsql-hackers(at)lists(dot)postgresql(dot)org" <pgsql-hackers(at)lists(dot)postgresql(dot)org>
Subject: Re: Avoiding roundoff error in pg_sleep()
Date: 2025-09-26 15:32:46
Message-ID: CAKFQuwY9ky1Qecwe4Hv8MtWRUnQiHAsVNS1Vb3E-NQfcpCV-9w@mail.gmail.com
Views: Whole Thread | Raw Message | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On Friday, September 26, 2025, Vladlen Popolitov <v(dot)popolitov(at)postgrespro(dot)ru>
wrote:

> Hi David,
>
> David G. Johnston писал(а) 2025-09-26 18:08:
>
>> On Friday, September 26, 2025, Vladlen Popolitov
>> <v(dot)popolitov(at)postgrespro(dot)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.

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Jacob Champion 2025-09-26 15:33:08 Re: test_json_parser/002_inline is kind of slow
Previous Message Nathan Bossart 2025-09-26 15:25:19 Re: test_json_parser/002_inline is kind of slow