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
b0b3187b
Commit
b0b3187b
authored
Jan 15, 2000
by
Tom Lane
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add some examples to numeric regress test to verify that recently-fixed
problems are indeed fixed.
parent
3cb8c8da
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
52 additions
and
0 deletions
+52
-0
src/test/regress/expected/numeric.out
src/test/regress/expected/numeric.out
+34
-0
src/test/regress/sql/numeric.sql
src/test/regress/sql/numeric.sql
+18
-0
No files found.
src/test/regress/expected/numeric.out
View file @
b0b3187b
...
...
@@ -660,3 +660,37 @@ SELECT t1.id1, t1.result, t2.expected
-----+--------+----------
(0 rows)
-- ******************************
-- * miscellaneous checks for things that have been broken in the past...
-- ******************************
-- numeric AVG used to fail on some platforms
SELECT AVG(val) FROM num_data;
avg
----------------------
-13430913.5922423207
(1 row)
-- Check for appropriate rounding and overflow
CREATE TABLE fract_only (id int, val numeric(4,4));
INSERT INTO fract_only VALUES (1, '0.0');
INSERT INTO fract_only VALUES (2, '0.1');
INSERT INTO fract_only VALUES (3, '1.0'); -- should fail
ERROR: overflow on numeric ABS(value) >= 10^0 for field with precision 4 scale 4
INSERT INTO fract_only VALUES (4, '-0.9999');
INSERT INTO fract_only VALUES (5, '0.99994');
INSERT INTO fract_only VALUES (6, '0.99995'); -- should fail
ERROR: overflow on numeric ABS(value) >= 10^0 for field with precision 4 scale 4
INSERT INTO fract_only VALUES (7, '0.00001');
INSERT INTO fract_only VALUES (8, '0.00017');
SELECT * FROM fract_only;
id | val
----+---------
1 | 0.0000
2 | 0.1000
4 | -0.9999
5 | 0.9999
7 | 0.0000
8 | 0.0002
(6 rows)
DROP TABLE fract_only;
src/test/regress/sql/numeric.sql
View file @
b0b3187b
...
...
@@ -634,3 +634,21 @@ SELECT t1.id1, t1.result, t2.expected
WHERE
t1
.
id1
=
t2
.
id
AND
t1
.
result
!=
t2
.
expected
;
-- ******************************
-- * miscellaneous checks for things that have been broken in the past...
-- ******************************
-- numeric AVG used to fail on some platforms
SELECT
AVG
(
val
)
FROM
num_data
;
-- Check for appropriate rounding and overflow
CREATE
TABLE
fract_only
(
id
int
,
val
numeric
(
4
,
4
));
INSERT
INTO
fract_only
VALUES
(
1
,
'0.0'
);
INSERT
INTO
fract_only
VALUES
(
2
,
'0.1'
);
INSERT
INTO
fract_only
VALUES
(
3
,
'1.0'
);
-- should fail
INSERT
INTO
fract_only
VALUES
(
4
,
'-0.9999'
);
INSERT
INTO
fract_only
VALUES
(
5
,
'0.99994'
);
INSERT
INTO
fract_only
VALUES
(
6
,
'0.99995'
);
-- should fail
INSERT
INTO
fract_only
VALUES
(
7
,
'0.00001'
);
INSERT
INTO
fract_only
VALUES
(
8
,
'0.00017'
);
SELECT
*
FROM
fract_only
;
DROP
TABLE
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