Re: Avoiding roundoff error in pg_sleep() - Mailing list pgsql-hackers

From David G. Johnston
Subject Re: Avoiding roundoff error in pg_sleep()
Date
Msg-id CAKFQuwY9ky1Qecwe4Hv8MtWRUnQiHAsVNS1Vb3E-NQfcpCV-9w@mail.gmail.com
Whole thread Raw
In response to Re: Avoiding roundoff error in pg_sleep()  (Vladlen Popolitov <v.popolitov@postgrespro.ru>)
List pgsql-hackers
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.

pgsql-hackers by date:

Previous
From: Nathan Bossart
Date:
Subject: Re: test_json_parser/002_inline is kind of slow
Next
From: Jacob Champion
Date:
Subject: Re: test_json_parser/002_inline is kind of slow