graphql-engine/server/src-lib
Antoine Leblanc 697137dd77 Fix Postgres not padding timestamps correctly (fix hasura/graphql-engine#8096)
## Description

As identified in hasura/graphql-engine#8096, the format string we used for timestamps was incorrect; we were using `%F`, which expands to `%Y-%m-%d`; but that meant that the year was not padded to four digits: `0001` would be represented simply as `1`. However, Postgres inteprets that `1` as `2001`, probably due to interpretation rules about two-digit years (in `25/12/01`, `01` is indeed `2001`).

```
# create table timestamp_test ( test timestamptz );
CREATE TABLE
# insert into timestamp_test values ('1-01-01T00:00:57Z');
INSERT 0 1
# select * from timestamp_test;
          test
------------------------
 2001-01-01 00:00:57+00
(1 row)
```

To fix this, this PR changes the format string to use `%0Y`, which always pads the year number with zeroes.

## Remaining work

- [x] write Changelog entry
- [ ] copy timestamp tests from the python suite into the hspec tests

PR-URL: https://github.com/hasura/graphql-engine-mono/pull/3536
GitOrigin-RevId: fa144111358339fd4a35b32d888c1d2c5b418ea6
2022-05-09 12:18:18 +00:00
..
Control server: simplify interpretation of concrete monads into abstract arrows 2022-04-04 12:36:35 +00:00
Data Added BackendConfig to allow sources to share configuration of Data Connectors [GDW-78] 2022-04-29 02:14:10 +00:00
Database/MSSQL (Fix #8267) Handle subscriptions in MSSQL when results exceed 2048 characters 2022-03-21 12:16:14 +00:00
GHC Yeet some default-extensions 2022-03-16 00:40:17 +00:00
Hasura Fix Postgres not padding timestamps correctly (fix hasura/graphql-engine#8096) 2022-05-09 12:18:18 +00:00
Network Yeet some default-extensions 2022-03-16 00:40:17 +00:00