model-writtenrun 1823 - may be wrong, links go to the source messages. Commit-by-commit LLM analysis is in the Commits dialog.
- Tom Lane reported that pg_sleep(0.001) slept for about 2 ms because floating-point roundoff inflated the WaitLatch delay, and attached a patch converting the input to integer microseconds while preserving NaN handling and capping enormous delays to avoid overflow #1.
- Vladlen Popolitov questioned whether very long sleeps could disrupt other work, but Tom explained that pg_sleep() supports query cancellation and that resource restrictions were a separate issue #2 #3.
- Robert Haas reproduced the behavior and approved the patch, while Nathan Bossart approved it after considering loop rearrangement and similarities to float8_timestamptz() #4 #6.
- Tom retained the existing loop structure because extra clock reads were negligible at the available sleep resolution, but adopted USECS_PER_SEC in place of the numeric conversion constant for clarity #7.
- Nathan suggested an inline alternative retaining floating-point calculations, but Tom questioned its correctness after interrupted waits and committed the attached integer-based patch with only the constant substitution and a comment clarification as 02c4bc8830 #8 #9.
- After the commit, Vladlen proposed making sleep a utility command to avoid holding transactions open; David G. Johnston treated that as separate work, and Tom recommended transaction_timeout and related controls instead of arbitrary restrictions #10 #11 #12.
- Vladlen continued disputing the function's documented effects, David requested a reproducing test case, and Robert closed the discussion by asking that redesign concerns move to a separate thread; the roundoff fix was landed with no further patch pending #13 #14 #15.