On Mon, Aug 13, 2012 at 10:14 PM, Noah Misch <noah@leadboat.com> wrote:
> If this use of SIGFPE is handy, we should expose it under a better name. What
> hazards make it unsafe?
Well, the most obvious problem is that a backend might receive it
while holding a spinlock.
> Overall, though, I think it best to plug this. We could set a flag before
> each operation, like evaluation of SQL arithmetic, for which SIGFPE is normal.
> If the signal handler sees the flag set, raise ERROR. Otherwise, PANIC. Code
> running with the flag set would, of course, need to be ready for a spontaneous
> elog(ERROR) at any instruction.
Yeah, that's what I thought of, too. It seems like it'd be a lot of
work to get there, though.
--
Robert Haas
EnterpriseDB: http://www.enterprisedb.com
The Enterprise PostgreSQL Company