Commit 6ed36b1
committed
Fix stdlib to return
The `TimeOID` case was missing from the stdlib `Rows.Next()` switch,
causing `time` columns to fall through to the `default` case. The
`default` case scans into a `string`, which is not a valid
`driver.Value` for temporal types. When `database/sql` attempts to
assign the resulting `string` to a `*time.Time` scan destination,
it fails with:
```
sql: Scan error on column index 0, name "t": unsupported Scan, storing
driver.Value type string into type *time.Time
```
To fix this, a `TimeOID` case is added that scans into `pgtype.Time` and
converts microseconds since midnight to `time.Time`, matching the
existing conversion in `timeWrapper.ScanTime`
(`pgtype/builtin_wrappers.go`).time.Time for PostgreSQL time columns1 parent 96b4dbd commit 6ed36b1
2 files changed
Lines changed: 44 additions & 1 deletion
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
712 | 712 | | |
713 | 713 | | |
714 | 714 | | |
715 | | - | |
| 715 | + | |
716 | 716 | | |
717 | 717 | | |
718 | 718 | | |
| |||
817 | 817 | | |
818 | 818 | | |
819 | 819 | | |
| 820 | + | |
| 821 | + | |
| 822 | + | |
| 823 | + | |
| 824 | + | |
| 825 | + | |
| 826 | + | |
| 827 | + | |
| 828 | + | |
| 829 | + | |
| 830 | + | |
| 831 | + | |
| 832 | + | |
| 833 | + | |
| 834 | + | |
| 835 | + | |
| 836 | + | |
| 837 | + | |
| 838 | + | |
| 839 | + | |
| 840 | + | |
| 841 | + | |
| 842 | + | |
| 843 | + | |
| 844 | + | |
| 845 | + | |
| 846 | + | |
| 847 | + | |
| 848 | + | |
| 849 | + | |
| 850 | + | |
| 851 | + | |
820 | 852 | | |
821 | 853 | | |
822 | 854 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
567 | 567 | | |
568 | 568 | | |
569 | 569 | | |
| 570 | + | |
| 571 | + | |
| 572 | + | |
| 573 | + | |
| 574 | + | |
| 575 | + | |
| 576 | + | |
| 577 | + | |
| 578 | + | |
| 579 | + | |
| 580 | + | |
570 | 581 | | |
571 | 582 | | |
572 | 583 | | |
| |||
0 commit comments