forked frompostgres/postgres
- Notifications
You must be signed in to change notification settings - Fork6
Commit50861cd
committed
Improve portability of I/O behavior for the geometric types.
Formerly, the geometric I/O routines such as box_in and point_out relieddirectly on strtod() and sprintf() for conversion of the float8 componentvalues of their data types. However, the behavior of those functions ispretty platform-dependent, especially for edge-case values such asinfinities and NaNs. This was exposed by commitacdf2a8, whichadded test cases involving boxes with infinity endpoints, and immediatelyfailed on Windows and AIX buildfarm members. We solved these problemsyears ago in the main float8in and float8out functions, so let's fix itby making the geometric types use that code instead of depending directlyon the platform-supplied functions.To do this, refactor the float8in code so that it can be used to parsejust part of a string, and as a convenience make the guts of float8outusable without going through DirectFunctionCall.While at it, get rid of geo_ops.c's fairly shaky assumptions about themaximum output string length for a double, by having it build results inStringInfo buffers instead of fixed-length strings.In passing, convert all the "invalid input syntax for type foo" messagesin this area of the code into "invalid input syntax for type %s" to reducethe number of distinct translatable strings, per recent discussion.We would have needed a fair number of the latter anyway for code-sharingreasons, so we might as well just go whole hog.Note: this patch is by no means intended to guarantee that the geometrictypes uniformly behave sanely for infinity or NaN component values.But any bugs we have in that line were there all along, they were justharder to reach in a platform-independent way.1 parent818e593 commit50861cd
File tree
4 files changed
+272
-314
lines changed- src
- backend/utils/adt
- include/utils
- test/regress/expected
4 files changed
+272
-314
lines changedLines changed: 63 additions & 22 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
411 | 411 |
| |
412 | 412 |
| |
413 | 413 |
| |
414 |
| - | |
| 414 | + | |
| 415 | + | |
| 416 | + | |
| 417 | + | |
| 418 | + | |
| 419 | + | |
| 420 | + | |
| 421 | + | |
| 422 | + | |
| 423 | + | |
| 424 | + | |
| 425 | + | |
| 426 | + | |
| 427 | + | |
| 428 | + | |
| 429 | + | |
| 430 | + | |
| 431 | + | |
| 432 | + | |
| 433 | + | |
| 434 | + | |
| 435 | + | |
| 436 | + | |
| 437 | + | |
| 438 | + | |
| 439 | + | |
415 | 440 |
| |
416 | 441 |
| |
417 | 442 |
| |
418 |
| - | |
419 |
| - | |
420 |
| - | |
421 |
| - | |
422 |
| - | |
423 |
| - | |
424 |
| - | |
425 | 443 |
| |
426 | 444 |
| |
427 | 445 |
| |
| |||
433 | 451 |
| |
434 | 452 |
| |
435 | 453 |
| |
436 |
| - | |
437 |
| - | |
| 454 | + | |
| 455 | + | |
438 | 456 |
| |
439 | 457 |
| |
440 | 458 |
| |
| |||
497 | 515 |
| |
498 | 516 |
| |
499 | 517 |
| |
| 518 | + | |
| 519 | + | |
| 520 | + | |
| 521 | + | |
500 | 522 |
| |
501 | 523 |
| |
| 524 | + | |
| 525 | + | |
| 526 | + | |
| 527 | + | |
502 | 528 |
| |
503 | 529 |
| |
504 | 530 |
| |
505 |
| - | |
| 531 | + | |
| 532 | + | |
506 | 533 |
| |
507 | 534 |
| |
508 | 535 |
| |
509 | 536 |
| |
510 |
| - | |
511 |
| - | |
| 537 | + | |
| 538 | + | |
512 | 539 |
| |
513 | 540 |
| |
514 | 541 |
| |
| |||
527 | 554 |
| |
528 | 555 |
| |
529 | 556 |
| |
530 |
| - | |
531 |
| - | |
| 557 | + | |
| 558 | + | |
| 559 | + | |
| 560 | + | |
532 | 561 |
| |
533 | 562 |
| |
534 |
| - | |
535 |
| - | |
| 563 | + | |
| 564 | + | |
536 | 565 |
| |
537 |
| - | |
538 |
| - | |
539 |
| - | |
| 566 | + | |
540 | 567 |
| |
541 | 568 |
| |
542 | 569 |
| |
| |||
547 | 574 |
| |
548 | 575 |
| |
549 | 576 |
| |
| 577 | + | |
| 578 | + | |
| 579 | + | |
| 580 | + | |
| 581 | + | |
| 582 | + | |
| 583 | + | |
| 584 | + | |
| 585 | + | |
| 586 | + | |
| 587 | + | |
| 588 | + | |
| 589 | + | |
| 590 | + | |
550 | 591 |
| |
551 | 592 |
| |
552 | 593 |
| |
553 |
| - | |
| 594 | + | |
554 | 595 |
| |
555 | 596 |
| |
556 | 597 |
| |
| |||
571 | 612 |
| |
572 | 613 |
| |
573 | 614 |
| |
574 |
| - | |
| 615 | + | |
575 | 616 |
| |
576 | 617 |
| |
577 | 618 |
| |
|
0 commit comments
Comments
(0)