Commit 24f4d3e
committed
postgres: Handle incoming ISO-8601 timestamps
Postgres' standard base representation of timestamps is "<date>
<time>", with a space as separator: "2025-10-13 16:09:06"; PG takes
that base format as input and returns as output.
Additionally, there is a Note on the same page that states:
ISO 8601 specifies the use of uppercase letter T to separate the date
and time. PostgreSQL accepts that format on input, but on output it
uses a space rather than T, as shown above. This is for readability
and for consistency with RFC 3339 as well as some other database
systems.
Some drivers (node-js, psychopg2) will, by default, send the ISO-8601
flavored string representation.
Readyset is currently not accepting the T separator variant in either
the simple query protocol (string -> `DfValue`), nor in the text
transfer format of the extended protocol path, a/k/a bound parameters
to prepared statements (`psql-srv::codec::decoder`).
This CL fixes both paths by performing the existing space-separator
parsing first, then trying the `T`-separator parse on error.
[0] www.postgresql.org/docs/current/datatype-datetime.html
Fixes: REA-6104
Release-Note-Core: Accept IS0-8601 string timestamp separator in
postgres (both simple and extended query protocols).
Change-Id: I096bb650540784f897210f19e00f8f8f0cbfbbac
Reviewed-on: https://gerrit.readyset.name/c/readyset/+/10678
Tested-by: Buildkite CI
Reviewed-by: Johnathan Davis <jcd@readyset.io>1 parent f45e248 commit 24f4d3e
2 files changed
+54
-4
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
50 | 50 | | |
51 | 51 | | |
52 | 52 | | |
| 53 | + | |
| 54 | + | |
| 55 | + | |
| 56 | + | |
53 | 57 | | |
54 | 58 | | |
| 59 | + | |
| 60 | + | |
| 61 | + | |
| 62 | + | |
| 63 | + | |
| 64 | + | |
55 | 65 | | |
56 | 66 | | |
57 | 67 | | |
| |||
455 | 465 | | |
456 | 466 | | |
457 | 467 | | |
458 | | - | |
| 468 | + | |
| 469 | + | |
| 470 | + | |
459 | 471 | | |
460 | 472 | | |
461 | 473 | | |
| |||
1482 | 1494 | | |
1483 | 1495 | | |
1484 | 1496 | | |
| 1497 | + | |
| 1498 | + | |
| 1499 | + | |
| 1500 | + | |
| 1501 | + | |
| 1502 | + | |
| 1503 | + | |
| 1504 | + | |
| 1505 | + | |
| 1506 | + | |
| 1507 | + | |
| 1508 | + | |
| 1509 | + | |
1485 | 1510 | | |
1486 | 1511 | | |
1487 | 1512 | | |
| |||
1494 | 1519 | | |
1495 | 1520 | | |
1496 | 1521 | | |
1497 | | - | |
1498 | 1522 | | |
1499 | 1523 | | |
1500 | 1524 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
15 | 15 | | |
16 | 16 | | |
17 | 17 | | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
18 | 21 | | |
19 | 22 | | |
20 | 23 | | |
| |||
388 | 391 | | |
389 | 392 | | |
390 | 393 | | |
| 394 | + | |
391 | 395 | | |
392 | 396 | | |
393 | 397 | | |
| |||
398 | 402 | | |
399 | 403 | | |
400 | 404 | | |
401 | | - | |
402 | | - | |
403 | 405 | | |
404 | 406 | | |
405 | 407 | | |
| |||
838 | 840 | | |
839 | 841 | | |
840 | 842 | | |
| 843 | + | |
| 844 | + | |
| 845 | + | |
| 846 | + | |
| 847 | + | |
| 848 | + | |
| 849 | + | |
| 850 | + | |
| 851 | + | |
| 852 | + | |
| 853 | + | |
| 854 | + | |
841 | 855 | | |
842 | 856 | | |
843 | 857 | | |
| |||
849 | 863 | | |
850 | 864 | | |
851 | 865 | | |
| 866 | + | |
| 867 | + | |
| 868 | + | |
| 869 | + | |
| 870 | + | |
| 871 | + | |
| 872 | + | |
| 873 | + | |
| 874 | + | |
| 875 | + | |
| 876 | + | |
| 877 | + | |
852 | 878 | | |
853 | 879 | | |
854 | 880 | | |
| |||
0 commit comments