Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit0a42adc

Browse files
committed
Improve numeric overflow error message.
David Fetter
1 parent45c8ed9 commit0a42adc

File tree

2 files changed

+6
-5
lines changed

2 files changed

+6
-5
lines changed

‎src/backend/utils/adt/numeric.c

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414
* Copyright (c) 1998-2006, PostgreSQL Global Development Group
1515
*
1616
* IDENTIFICATION
17-
* $PostgreSQL: pgsql/src/backend/utils/adt/numeric.c,v 1.94 2006/07/14 05:28:28 tgl Exp $
17+
* $PostgreSQL: pgsql/src/backend/utils/adt/numeric.c,v 1.95 2006/10/03 21:25:55 momjian Exp $
1818
*
1919
*-------------------------------------------------------------------------
2020
*/
@@ -3217,11 +3217,12 @@ apply_typmod(NumericVar *var, int32 typmod)
32173217
ereport(ERROR,
32183218
(errcode(ERRCODE_NUMERIC_VALUE_OUT_OF_RANGE),
32193219
errmsg("numeric field overflow"),
3220-
errdetail("A field with precision %d, scale %d musthave an absolute value less than %s%d.",
3220+
errdetail("A field with precision %d, scale %d mustround to an absolute value less than %s%d.",
32213221
precision,scale,
32223222
/* Display 10^0 as 1 */
32233223
maxdigits ?"10^" :"",
3224-
maxdigits ?maxdigits :1)));
3224+
maxdigits ?maxdigits :1
3225+
)));
32253226
break;
32263227
}
32273228
ddigits-=DEC_DIGITS;

‎src/test/regress/expected/numeric.out

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -688,12 +688,12 @@ INSERT INTO fract_only VALUES (1, '0.0');
688688
INSERT INTO fract_only VALUES (2, '0.1');
689689
INSERT INTO fract_only VALUES (3, '1.0');-- should fail
690690
ERROR: numeric field overflow
691-
DETAIL: A field with precision 4, scale 4 musthave an absolute value less than 1.
691+
DETAIL: A field with precision 4, scale 4 mustround to an absolute value less than 1.
692692
INSERT INTO fract_only VALUES (4, '-0.9999');
693693
INSERT INTO fract_only VALUES (5, '0.99994');
694694
INSERT INTO fract_only VALUES (6, '0.99995'); -- should fail
695695
ERROR: numeric field overflow
696-
DETAIL: A field with precision 4, scale 4 musthave an absolute value less than 1.
696+
DETAIL: A field with precision 4, scale 4 mustround to an absolute value less than 1.
697697
INSERT INTO fract_only VALUES (7, '0.00001');
698698
INSERT INTO fract_only VALUES (8, '0.00017');
699699
SELECT * FROM fract_only;

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp