Index: src/backend/utils/adt/int.c
===================================================================
RCS file: /cvsroot/pgsql/src/backend/utils/adt/int.c,v
retrieving revision 1.72
diff -c -c -r1.72 int.c
*** src/backend/utils/adt/int.c	11 Mar 2006 01:19:22 -0000	1.72
--- src/backend/utils/adt/int.c	9 Jun 2006 02:36:32 -0000
***************
*** 735,740 ****
--- 735,751 ----
  	int32		arg2 = PG_GETARG_INT32(1);
  	int32		result;
  
+ #ifdef WIN32
+ 	/*
+ 	 *	Win32 doesn't throw a catchable exception for
+ 	 *	SELECT -2147483648 /* INT_MIN */ * (-1);
+ 	 */
+ 	if (arg2 == -1 && arg1 == INT_MIN)
+ 		ereport(ERROR,
+ 				(errcode(ERRCODE_NUMERIC_VALUE_OUT_OF_RANGE),
+ 				 errmsg("integer out of range")));
+ #endif
+ 
  	result = arg1 * arg2;
  
  	/*
***************
*** 770,775 ****
--- 781,797 ----
  				(errcode(ERRCODE_DIVISION_BY_ZERO),
  				 errmsg("division by zero")));
  
+ #ifdef WIN32
+ 	/*
+ 	 *	Win32 doesn't throw a catchable exception for
+ 	 *	SELECT -2147483648 /* INT_MIN */ / (-1);
+ 	 */
+ 	if (arg2 == -1 && arg1 == INT_MIN)
+ 		ereport(ERROR,
+ 				(errcode(ERRCODE_NUMERIC_VALUE_OUT_OF_RANGE),
+ 				 errmsg("integer out of range")));
+ #endif
+ 
  	result = arg1 / arg2;
  
  	/*
