Commit c484124
committed
db.pg: route infinity through the timestamp parser and reject BC dates
Address PR review feedback on the TIMESTAMPTZ decoder:
- val_to_primitive: a time value is now decoded via time.unix() only when the
string is a bare integer (Unix timestamp). Every other value, including
`infinity` (which has no date/time punctuation), is routed through
pg_parse_timestamp() so it produces the clear special-value error instead of
silently falling through to time.unix(0).
- pg_parse_timestamp: reject PostgreSQL BC timestamps (` BC` suffix) with a
clear error, and parse the date/time fields and timezone offset with strict
strconv.atoi so stray suffixes are rejected rather than silently truncated by
string.int().
Adds tests for the BC suffix (with and without offset), a trailing non-numeric
suffix, the Unix-timestamp path, and `infinity` decoded via val_to_primitive.1 parent fcc0c26 commit c484124
2 files changed
Lines changed: 71 additions & 18 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
2 | 2 | | |
3 | 3 | | |
4 | 4 | | |
| 5 | + | |
5 | 6 | | |
6 | 7 | | |
7 | 8 | | |
| |||
473 | 474 | | |
474 | 475 | | |
475 | 476 | | |
| 477 | + | |
| 478 | + | |
| 479 | + | |
| 480 | + | |
| 481 | + | |
| 482 | + | |
476 | 483 | | |
477 | 484 | | |
478 | 485 | | |
| |||
510 | 517 | | |
511 | 518 | | |
512 | 519 | | |
513 | | - | |
514 | | - | |
| 520 | + | |
| 521 | + | |
| 522 | + | |
| 523 | + | |
| 524 | + | |
515 | 525 | | |
516 | | - | |
| 526 | + | |
517 | 527 | | |
518 | 528 | | |
519 | 529 | | |
| |||
525 | 535 | | |
526 | 536 | | |
527 | 537 | | |
| 538 | + | |
| 539 | + | |
528 | 540 | | |
529 | | - | |
530 | | - | |
531 | | - | |
532 | | - | |
533 | | - | |
534 | | - | |
| 541 | + | |
| 542 | + | |
| 543 | + | |
| 544 | + | |
| 545 | + | |
| 546 | + | |
535 | 547 | | |
536 | 548 | | |
537 | 549 | | |
| |||
550 | 562 | | |
551 | 563 | | |
552 | 564 | | |
553 | | - | |
| 565 | + | |
554 | 566 | | |
555 | | - | |
| 567 | + | |
556 | 568 | | |
557 | 569 | | |
558 | | - | |
| 570 | + | |
559 | 571 | | |
560 | 572 | | |
561 | 573 | | |
| |||
615 | 627 | | |
616 | 628 | | |
617 | 629 | | |
618 | | - | |
619 | | - | |
620 | | - | |
| 630 | + | |
| 631 | + | |
| 632 | + | |
| 633 | + | |
| 634 | + | |
| 635 | + | |
621 | 636 | | |
622 | | - | |
623 | | - | |
624 | | - | |
| 637 | + | |
625 | 638 | | |
626 | 639 | | |
627 | 640 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1 | 1 | | |
2 | 2 | | |
| 3 | + | |
3 | 4 | | |
4 | 5 | | |
5 | 6 | | |
| |||
95 | 96 | | |
96 | 97 | | |
97 | 98 | | |
| 99 | + | |
| 100 | + | |
| 101 | + | |
| 102 | + | |
| 103 | + | |
| 104 | + | |
| 105 | + | |
| 106 | + | |
| 107 | + | |
| 108 | + | |
| 109 | + | |
| 110 | + | |
| 111 | + | |
| 112 | + | |
| 113 | + | |
| 114 | + | |
| 115 | + | |
| 116 | + | |
| 117 | + | |
| 118 | + | |
| 119 | + | |
| 120 | + | |
| 121 | + | |
| 122 | + | |
| 123 | + | |
| 124 | + | |
| 125 | + | |
| 126 | + | |
| 127 | + | |
| 128 | + | |
| 129 | + | |
| 130 | + | |
| 131 | + | |
| 132 | + | |
| 133 | + | |
| 134 | + | |
| 135 | + | |
| 136 | + | |
| 137 | + | |
98 | 138 | | |
99 | 139 | | |
100 | 140 | | |
| |||
0 commit comments