On 12/11/2026 17:17, Tom Lane wrote:
Heikki Linnakangas <[email protected]> writes:
So, I propose to:
1. Change FloatExceptionHandler() to PANIC instead of ERROR
2. Install FloatExceptionHandler() in all processes.
Agree on #2, violently against #1. Why is it an improvement for
division-by-zero to take down the entire system?
It seems unsafe to assume that you can gracefully recover from an ERROR
on any division-by-zero. Imagine a snippet like this:
LWLockAcquire(FooLock, LW_EXCLUSIVE);
shmem->foo = DONE;
shmem->bar = 100 / x;
LWLockRelease(FooLock);
The "100 / x" can ERROR out, release the lock, and leave shmem in an
unexpected state (the compiler can reorder the assignments, too).
That's probably rare, in most cases it is safe to ERROR out, but I think
we should err on the side of caution.
- Heikki