Дейтер Александр Валериевич <tiamat@komi.mts.ru> writes:
> PostgreSQL 8.1.5 have a problem with division by zero on sparc.
> Solaris 9 sparc, gcc 4.0.2, 4.1.1:
We've not heard that reported before, so I wonder whether there's not
something broken about your compiler or libc.
The code in question is in int2div() in utils/adt/int.c:
if (arg2 == 0) ereport(ERROR, (errcode(ERRCODE_DIVISION_BY_ZERO),
errmsg("divisionby zero")));
result = arg1 / arg2;
It's a bit hard to see how a compiler could get this wrong, but maybe
it's thinking it can evaluate the division before calling errfinish?
regards, tom lane