Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
P
Postgres FD Implementation
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Abuhujair Javed
Postgres FD Implementation
Commits
0a42adcc
Commit
0a42adcc
authored
Oct 03, 2006
by
Bruce Momjian
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Improve numeric overflow error message.
David Fetter
parent
45c8ed96
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
6 additions
and
5 deletions
+6
-5
src/backend/utils/adt/numeric.c
src/backend/utils/adt/numeric.c
+4
-3
src/test/regress/expected/numeric.out
src/test/regress/expected/numeric.out
+2
-2
No files found.
src/backend/utils/adt/numeric.c
View file @
0a42adcc
...
@@ -14,7 +14,7 @@
...
@@ -14,7 +14,7 @@
* Copyright (c) 1998-2006, PostgreSQL Global Development Group
* Copyright (c) 1998-2006, PostgreSQL Global Development Group
*
*
* IDENTIFICATION
* IDENTIFICATION
* $PostgreSQL: pgsql/src/backend/utils/adt/numeric.c,v 1.9
4 2006/07/14 05:28:28 tgl
Exp $
* $PostgreSQL: pgsql/src/backend/utils/adt/numeric.c,v 1.9
5 2006/10/03 21:25:55 momjian
Exp $
*
*
*-------------------------------------------------------------------------
*-------------------------------------------------------------------------
*/
*/
...
@@ -3217,11 +3217,12 @@ apply_typmod(NumericVar *var, int32 typmod)
...
@@ -3217,11 +3217,12 @@ apply_typmod(NumericVar *var, int32 typmod)
ereport
(
ERROR
,
ereport
(
ERROR
,
(
errcode
(
ERRCODE_NUMERIC_VALUE_OUT_OF_RANGE
),
(
errcode
(
ERRCODE_NUMERIC_VALUE_OUT_OF_RANGE
),
errmsg
(
"numeric field overflow"
),
errmsg
(
"numeric field overflow"
),
errdetail
(
"A field with precision %d, scale %d must
have
an absolute value less than %s%d."
,
errdetail
(
"A field with precision %d, scale %d must
round to
an absolute value less than %s%d."
,
precision
,
scale
,
precision
,
scale
,
/* Display 10^0 as 1 */
/* Display 10^0 as 1 */
maxdigits
?
"10^"
:
""
,
maxdigits
?
"10^"
:
""
,
maxdigits
?
maxdigits
:
1
)));
maxdigits
?
maxdigits
:
1
)));
break
;
break
;
}
}
ddigits
-=
DEC_DIGITS
;
ddigits
-=
DEC_DIGITS
;
...
...
src/test/regress/expected/numeric.out
View file @
0a42adcc
...
@@ -688,12 +688,12 @@ INSERT INTO fract_only VALUES (1, '0.0');
...
@@ -688,12 +688,12 @@ INSERT INTO fract_only VALUES (1, '0.0');
INSERT INTO fract_only VALUES (2, '0.1');
INSERT INTO fract_only VALUES (2, '0.1');
INSERT INTO fract_only VALUES (3, '1.0'); -- should fail
INSERT INTO fract_only VALUES (3, '1.0'); -- should fail
ERROR: numeric field overflow
ERROR: numeric field overflow
DETAIL: A field with precision 4, scale 4 must
have
an absolute value less than 1.
DETAIL: A field with precision 4, scale 4 must
round to
an absolute value less than 1.
INSERT INTO fract_only VALUES (4, '-0.9999');
INSERT INTO fract_only VALUES (4, '-0.9999');
INSERT INTO fract_only VALUES (5, '0.99994');
INSERT INTO fract_only VALUES (5, '0.99994');
INSERT INTO fract_only VALUES (6, '0.99995'); -- should fail
INSERT INTO fract_only VALUES (6, '0.99995'); -- should fail
ERROR: numeric field overflow
ERROR: numeric field overflow
DETAIL: A field with precision 4, scale 4 must
have
an absolute value less than 1.
DETAIL: A field with precision 4, scale 4 must
round to
an absolute value less than 1.
INSERT INTO fract_only VALUES (7, '0.00001');
INSERT INTO fract_only VALUES (7, '0.00001');
INSERT INTO fract_only VALUES (8, '0.00017');
INSERT INTO fract_only VALUES (8, '0.00017');
SELECT * FROM fract_only;
SELECT * FROM fract_only;
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment