Since x % -1 returns 0 for any x, we don't need the check x == INT_MIN.
Suggested by Tom Lane.
---src/backend/utils/adt/int.c | 2 +-1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/src/backend/utils/adt/int.c b/src/backend/utils/adt/int.c
index 4be3901..3e423fe 100644
--- a/src/backend/utils/adt/int.c
+++ b/src/backend/utils/adt/int.c
@@ -1096,7 +1096,7 @@ int4mod(PG_FUNCTION_ARGS) } /* SELECT ((-2147483648)::int4) % (-1); causes a floating point
exception*/
- if (arg1 == INT_MIN && arg2 == -1)
+ if (arg2 == -1) PG_RETURN_INT32(0); /* No overflow is possible */
--
1.7.10.4