-
Notifications
You must be signed in to change notification settings - Fork 14
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Browse files
Browse the repository at this point in the history
Fix output precision limit for double values (issue #118) pgSphere used its own setting (set_sphere_output_precision function) to limit the output precision of double values, that could not be greater than 15 significant digits (DBL_DIG). It introduced some problems with dump/restore. PostgreSQL uses its own precision setting: extra_float_digits. The PostgreSQL setting allows to use more significant digits. This patch changes the default pgSphere output behaviour to utilize PostgreSQL extra_float_digits. Now, extra_float_digits is used by default, until set_sphere_output_precision is called. The old behaviour is kept for compatibility purposes. Once, set_sphere_output_precision is called, pgSphere starts to use the old behaviour (read, please, issue #118 discussion). The patch introduces a new function - reset_sphere_output_precision. It is used to reset to the PostgreSQL behaviour after using set_sphere_output_precision. * Update upgrade script (reset_sphere_output_precision function) * Add test for pgSphere output precision with different settings expected/output_precision.out - PG 10-11 expected/output_precision_1.out - PG 12+ * Add extra_float_digits = 2 for epochprop and bounding_box_gist tests
- Loading branch information
Showing
13 changed files
with
1,283 additions
and
55 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,108 @@ | ||
SET extra_float_digits = 2; | ||
SELECT | ||
to_char(DEGREES(tp[1]), '999D9999999999'), | ||
to_char(DEGREES(tp[2]), '999D9999999999'), | ||
to_char(tp[3], '999D999'), | ||
to_char(DEGREES(tp[4])*3.6e6, '999D999'), | ||
to_char(DEGREES(tp[5])*3.6e6, '99999D999'), | ||
to_char(tp[6], '999D999') | ||
FROM ( | ||
SELECT epoch_prop(spoint(radians(269.45207695), radians(4.693364966)), | ||
546.9759, | ||
RADIANS(-801.551/3.6e6), RADIANS(10362/3.6e6), -110, | ||
-100) AS tp) AS q; | ||
to_char | to_char | to_char | to_char | to_char | to_char | ||
-----------------+-----------------+----------+----------+------------+---------- | ||
269.4742714391 | 4.4072939987 | 543.624 | -791.442 | 10235.412 | -110.450 | ||
(1 row) | ||
|
||
SELECT | ||
to_char(DEGREES(tp[1]), '999D9999999999'), | ||
to_char(DEGREES(tp[2]), '999D9999999999'), | ||
to_char(tp[3], '999D999'), | ||
to_char(DEGREES(tp[4])*3.6e6, '999D999'), | ||
to_char(DEGREES(tp[5])*3.6e6, '99999D999'), | ||
to_char(tp[6], '999D999') | ||
FROM ( | ||
SELECT epoch_prop(spoint(radians(269.45207695), radians(4.693364966)), | ||
0, | ||
RADIANS(-801.551/3.6e6), RADIANS(10362/3.6e6), -110, | ||
-100) AS tp) AS q; | ||
to_char | to_char | to_char | to_char | to_char | to_char | ||
-----------------+-----------------+---------+----------+------------+--------- | ||
269.4744079540 | 4.4055337210 | | -801.210 | 10361.762 | | ||
(1 row) | ||
|
||
SELECT | ||
to_char(DEGREES(tp[1]), '999D9999999999'), | ||
to_char(DEGREES(tp[2]), '999D9999999999'), | ||
to_char(tp[3], '999D999'), | ||
to_char(DEGREES(tp[4])*3.6e6, '999D999'), | ||
to_char(DEGREES(tp[5])*3.6e6, '99999D999'), | ||
to_char(tp[6], '999D999') | ||
FROM ( | ||
SELECT epoch_prop(spoint(radians(269.45207695), radians(4.693364966)), | ||
NULL, | ||
RADIANS(-801.551/3.6e6), RADIANS(10362/3.6e6), -110, | ||
-100) AS tp) AS q; | ||
to_char | to_char | to_char | to_char | to_char | to_char | ||
-----------------+-----------------+---------+----------+------------+--------- | ||
269.4744079540 | 4.4055337210 | | -801.210 | 10361.762 | | ||
(1 row) | ||
|
||
SELECT | ||
to_char(DEGREES(tp[1]), '999D9999999999'), | ||
to_char(DEGREES(tp[2]), '999D9999999999'), | ||
to_char(tp[3], '999D999'), | ||
to_char(DEGREES(tp[4])*3.6e6, '999D999'), | ||
to_char(DEGREES(tp[5])*3.6e6, '99999D999'), | ||
to_char(tp[6], '999D999') | ||
FROM ( | ||
SELECT epoch_prop(spoint(radians(269.45207695), radians(4.693364966)), | ||
23, | ||
RADIANS(-801.551/3.6e6), RADIANS(10362/3.6e6), NULL, | ||
20) AS tp) AS q; | ||
to_char | to_char | to_char | to_char | to_char | to_char | ||
-----------------+-----------------+----------+----------+------------+---------- | ||
269.4476085384 | 4.7509315989 | 23.000 | -801.617 | 10361.984 | 2.159 | ||
(1 row) | ||
|
||
SELECT | ||
to_char(DEGREES(tp[1]), '999D9999999999'), | ||
to_char(DEGREES(tp[2]), '999D9999999999'), | ||
to_char(tp[3], '999D999'), | ||
to_char(DEGREES(tp[4])*3.6e6, '999D999'), | ||
to_char(DEGREES(tp[5])*3.6e6, '99999D999'), | ||
to_char(tp[6], '999D999') | ||
FROM ( | ||
SELECT epoch_prop(spoint(radians(269.45207695), radians(4.693364966)), | ||
23, | ||
NULL, RADIANS(10362/3.6e6), -110, | ||
120) AS tp) AS q; | ||
to_char | to_char | to_char | to_char | to_char | to_char | ||
-----------------+-----------------+----------+----------+------------+---------- | ||
269.4520769500 | 5.0388680565 | 23.007 | -.000 | 10368.061 | -97.120 | ||
(1 row) | ||
|
||
SELECT epoch_prop(NULL, | ||
23, | ||
0.01 , RADIANS(10362/3.6e6), -110, | ||
120); | ||
ERROR: NULL position not supported in epoch propagation | ||
SELECT epoch_prop_pos(spoint(radians(269.45207695), radians(4.693364966)), | ||
23, | ||
RADIANS(-801.551/3.6e6), RADIANS(10362/3.6e6), -110, | ||
20) AS tp; | ||
tp | ||
------------------------------------------- | ||
(4.702747926583129 , 0.08291945093459933) | ||
(1 row) | ||
|
||
SELECT epoch_prop_pos(spoint(radians(269.45207695), radians(4.693364966)), | ||
RADIANS(-801.551/3.6e6), RADIANS(10362/3.6e6), | ||
20) AS tp; | ||
tp | ||
------------------------------------------- | ||
(4.702747930619516 , 0.08291939893808763) | ||
(1 row) | ||
|
Oops, something went wrong.