aboutsummaryrefslogtreecommitdiff
path: root/src/backend/utils/adt/timestamp.c
diff options
context:
space:
mode:
authorTom Lane <tgl@sss.pgh.pa.us>2003-03-11 21:01:33 +0000
committerTom Lane <tgl@sss.pgh.pa.us>2003-03-11 21:01:33 +0000
commit31e69ccb210cf49712f77facbf90661d8bc2eed5 (patch)
treeec6e0c1a656051db532cdef53a84309d6180c4a1 /src/backend/utils/adt/timestamp.c
parent6261c75014c9948837d9d025493ef18b8f833f70 (diff)
downloadpostgresql-31e69ccb210cf49712f77facbf90661d8bc2eed5.tar.gz
postgresql-31e69ccb210cf49712f77facbf90661d8bc2eed5.zip
Add explicit tests for division by zero to all user-accessible integer
division and modulo functions, to avoid problems on OS X (which fails to trap 0 divide at all) and Windows (which traps it in some bizarre nonstandard fashion). Standardize on 'division by zero' as the one true spelling of this error message. Add regression tests as suggested by Neil Conway.
Diffstat (limited to 'src/backend/utils/adt/timestamp.c')
-rw-r--r--src/backend/utils/adt/timestamp.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/src/backend/utils/adt/timestamp.c b/src/backend/utils/adt/timestamp.c
index d3390fd3274..2764fee906a 100644
--- a/src/backend/utils/adt/timestamp.c
+++ b/src/backend/utils/adt/timestamp.c
@@ -8,7 +8,7 @@
*
*
* IDENTIFICATION
- * $Header: /cvsroot/pgsql/src/backend/utils/adt/timestamp.c,v 1.79 2003/02/27 21:36:58 tgl Exp $
+ * $Header: /cvsroot/pgsql/src/backend/utils/adt/timestamp.c,v 1.80 2003/03/11 21:01:33 tgl Exp $
*
*-------------------------------------------------------------------------
*/
@@ -1869,7 +1869,7 @@ interval_div(PG_FUNCTION_ARGS)
result = (Interval *) palloc(sizeof(Interval));
if (factor == 0.0)
- elog(ERROR, "interval_div: divide by 0.0 error");
+ elog(ERROR, "division by zero");
#ifdef HAVE_INT64_TIMESTAMP
result->month = (span->month / factor);