]> granicus.if.org Git - postgresql/commitdiff
Update regression error message for NUMERIC range overflow. Display "1"
authorBruce Momjian <bruce@momjian.us>
Wed, 25 Jan 2006 18:15:03 +0000 (18:15 +0000)
committerBruce Momjian <bruce@momjian.us>
Wed, 25 Jan 2006 18:15:03 +0000 (18:15 +0000)
instead of 10^0.

src/backend/utils/adt/numeric.c

index dcc9a7d6836fcb391832ed1dbfc77bd46ac3af9d..bd1e28d64b93738c796382b9a1df469c04a5274b 100644 (file)
@@ -14,7 +14,7 @@
  * Copyright (c) 1998-2005, PostgreSQL Global Development Group
  *
  * IDENTIFICATION
- *       $PostgreSQL: pgsql/src/backend/utils/adt/numeric.c,v 1.89 2006/01/25 17:54:14 momjian Exp $
+ *       $PostgreSQL: pgsql/src/backend/utils/adt/numeric.c,v 1.90 2006/01/25 18:15:03 momjian Exp $
  *
  *-------------------------------------------------------------------------
  */
@@ -3206,8 +3206,11 @@ apply_typmod(NumericVar *var, int32 typmod)
                                        ereport(ERROR,
                                                        (errcode(ERRCODE_NUMERIC_VALUE_OUT_OF_RANGE),
                                                         errmsg("numeric field overflow"),
-                                                        errdetail("A field with precision %d, scale %d must have an absolute value less than 10^%d.",
-                                                                          precision, scale, maxdigits)));
+                                                        errdetail("A field with precision %d, scale %d must have an absolute value less than %s%d.",
+                                                                          precision, scale,
+                                                                          /* Display 10^0 as 1 */
+                                                                          maxdigits ? "10^" : "",
+                                                                          maxdigits ? maxdigits : 1)));
                                break;
                        }
                        ddigits -= DEC_DIGITS;