Commit f31a931
committed
Improve contrib/cube's handling of zero-D cubes, infinities, and NaNs.
It's always been possible to create a zero-dimensional cube by converting
from a zero-length float8 array, but cube_in failed to accept the '()'
representation that cube_out produced for that case, resulting in a
dump/reload hazard. Make it accept the case. Also fix a couple of
other places that didn't behave sanely for zero-dimensional cubes:
cube_size would produce 1.0 when surely the answer should be 0.0,
and g_cube_distance risked a divide-by-zero failure.
Likewise, it's always been possible to create cubes containing float8
infinity or NaN coordinate values, but cube_in couldn't parse such input,
and cube_out produced platform-dependent spellings of the values. Convert
them to use float8in_internal and float8out_internal so that the behavior
will be the same as for float8, as we recently did for the core geometric
types (cf commit 50861cd). As in that commit, I don't pretend that this
patch fixes all insane corner-case behaviors that may exist for NaNs, but
it's a step forward.
(This change allows removal of the separate cube_1.out and cube_3.out
expected-files, as the platform dependency that previously required them
is now gone: an underflowing coordinate value will now produce an error
not plus or minus zero.)
Make errors from cube_in follow project conventions as to spelling
("invalid input syntax for cube" not "bad cube representation")
and errcode (INVALID_TEXT_REPRESENTATION not SYNTAX_ERROR).
Also a few marginal code cleanups and comment improvements.
Tom Lane, reviewed by Amul Sul
Discussion: <15085.1472494782@sss.pgh.pa.us>1 parent 51c3e9f commit f31a931
File tree
9 files changed
+275
-3626
lines changed- contrib/cube
- expected
- sql
9 files changed
+275
-3626
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
122 | 122 | | |
123 | 123 | | |
124 | 124 | | |
125 | | - | |
| 125 | + | |
126 | 126 | | |
127 | 127 | | |
128 | 128 | | |
| |||
254 | 254 | | |
255 | 255 | | |
256 | 256 | | |
257 | | - | |
258 | | - | |
259 | 257 | | |
260 | 258 | | |
261 | 259 | | |
262 | | - | |
263 | 260 | | |
264 | 261 | | |
265 | 262 | | |
| |||
276 | 273 | | |
277 | 274 | | |
278 | 275 | | |
279 | | - | |
280 | 276 | | |
281 | 277 | | |
282 | 278 | | |
283 | | - | |
284 | | - | |
285 | | - | |
286 | | - | |
287 | | - | |
288 | | - | |
289 | | - | |
290 | | - | |
291 | | - | |
292 | | - | |
293 | | - | |
294 | 279 | | |
295 | 280 | | |
296 | 281 | | |
297 | 282 | | |
298 | 283 | | |
299 | | - | |
| 284 | + | |
300 | 285 | | |
301 | 286 | | |
302 | 287 | | |
| |||
307 | 292 | | |
308 | 293 | | |
309 | 294 | | |
310 | | - | |
| 295 | + | |
311 | 296 | | |
312 | 297 | | |
313 | 298 | | |
| |||
370 | 355 | | |
371 | 356 | | |
372 | 357 | | |
373 | | - | |
374 | | - | |
375 | | - | |
376 | 358 | | |
377 | 359 | | |
378 | 360 | | |
| |||
441 | 423 | | |
442 | 424 | | |
443 | 425 | | |
444 | | - | |
445 | | - | |
446 | | - | |
447 | 426 | | |
448 | 427 | | |
449 | 428 | | |
| |||
484 | 463 | | |
485 | 464 | | |
486 | 465 | | |
487 | | - | |
488 | | - | |
489 | | - | |
490 | 466 | | |
491 | 467 | | |
492 | 468 | | |
| |||
617 | 593 | | |
618 | 594 | | |
619 | 595 | | |
620 | | - | |
621 | | - | |
622 | | - | |
623 | 596 | | |
624 | 597 | | |
625 | 598 | | |
| |||
633 | 606 | | |
634 | 607 | | |
635 | 608 | | |
636 | | - | |
637 | | - | |
638 | | - | |
639 | 609 | | |
640 | 610 | | |
641 | 611 | | |
| |||
665 | 635 | | |
666 | 636 | | |
667 | 637 | | |
668 | | - | |
669 | | - | |
670 | | - | |
671 | 638 | | |
672 | 639 | | |
673 | 640 | | |
| |||
865 | 832 | | |
866 | 833 | | |
867 | 834 | | |
868 | | - | |
869 | | - | |
870 | | - | |
871 | | - | |
872 | | - | |
873 | 835 | | |
| 836 | + | |
874 | 837 | | |
875 | 838 | | |
876 | 839 | | |
877 | 840 | | |
878 | 841 | | |
879 | 842 | | |
880 | 843 | | |
| 844 | + | |
881 | 845 | | |
882 | 846 | | |
883 | 847 | | |
884 | | - | |
| 848 | + | |
| 849 | + | |
| 850 | + | |
| 851 | + | |
| 852 | + | |
| 853 | + | |
| 854 | + | |
| 855 | + | |
| 856 | + | |
885 | 857 | | |
886 | 858 | | |
887 | | - | |
| 859 | + | |
888 | 860 | | |
889 | | - | |
| 861 | + | |
890 | 862 | | |
891 | | - | |
| 863 | + | |
892 | 864 | | |
893 | 865 | | |
894 | 866 | | |
| |||
1155 | 1127 | | |
1156 | 1128 | | |
1157 | 1129 | | |
1158 | | - | |
1159 | | - | |
1160 | | - | |
1161 | | - | |
1162 | 1130 | | |
1163 | 1131 | | |
1164 | 1132 | | |
| |||
1370 | 1338 | | |
1371 | 1339 | | |
1372 | 1340 | | |
1373 | | - | |
| 1341 | + | |
| 1342 | + | |
| 1343 | + | |
1374 | 1344 | | |
1375 | 1345 | | |
1376 | 1346 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1 | 1 | | |
2 | 2 | | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
3 | 7 | | |
4 | 8 | | |
5 | 9 | | |
| |||
29 | 33 | | |
30 | 34 | | |
31 | 35 | | |
| 36 | + | |
32 | 37 | | |
33 | 38 | | |
34 | 39 | | |
| |||
43 | 48 | | |
44 | 49 | | |
45 | 50 | | |
| 51 | + | |
46 | 52 | | |
47 | 53 | | |
48 | 54 | | |
49 | 55 | | |
| 56 | + | |
50 | 57 | | |
51 | 58 | | |
52 | 59 | | |
| |||
0 commit comments