Tom Lane <[EMAIL PROTECTED]> writes: > This query would invoke the following code in int4div: > > if (arg2 == 0) > ereport(ERROR, > (errcode(ERRCODE_DIVISION_BY_ZERO), > errmsg("division by zero"))); > > result = arg1 / arg2; > > I suggest directing some strong words to your compiler vendor. If the > "if" test doesn't complete before the subsequent division causes a trap, > that is not our problem.
I have a vague memory that IEEE floats have zero coming in two flavours, 0 and -0. I wonder if it's possible merely comparing against 0 isn't covering all the possible cases that can trigger a division by zero trap. -- greg ---------------------------(end of broadcast)--------------------------- TIP 9: the planner will ignore your desire to choose an index scan if your joining column's datatypes do not match