Bruce Momjian wrote:
> 
> 
> The big question is how to fix this on Win32.  Is a test in the
integer
> division routines enough?  

All divisions could be tested and the appropriate signal could get
raised by the handler.  I would hate to see what this would do to the
source.  In windows you can raise your own signals and we could probably
kludge it out that way.

> Is there a signal to catch on Win32?

There is not: in windows we use __try/__except in C and try/catch in
C++.  This is a vendor implementation but works in both borland and
microsoft compilers.  No idea elsewhere.

Here are the signals you do get: <quote>
SIGABRT

Abnormal termination. The default action terminates the calling program
with exit code 3.

SIGFPE

Floating-point error, such as overflow, division by zero, or invalid
operation. The default action terminates the calling program.  

SIGILL

Illegal instruction. The default action terminates the calling program.

SIGINT

CTRL+C interrupt. The default action issues INT 23H.

SIGSEGV

Illegal storage access. The default action terminates the calling
program.

SIGTERM

Termination request sent to the program. The default action terminates
the calling program

</endquote>


Ideally, the exception could be caught and transferred to the
appropriate handler.  Its really hard to say how this would interact
with the postgres exception handler without a thorough investigation.

I would only perform a test following each divide as a last resort.

Merlin

Mon, 10 Mar 2003 13:19:19 -0500
"Merlin Moncure" <merlin.moncure@rcsonline.com>
Re: [GENERAL] division by zero