graphql-engine/server/src-lib/Hasura/Backends/Postgres
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
..
Connection Yeet some default-extensions 2022-03-16 00:40:17 +00:00
DDL Remove explicit case on the backend tag in Cache 2022-05-05 13:44:56 +00:00
Execute Cut ties with RQL.DML.Internal 2022-04-27 15:37:23 +00:00
Instances Remove explicit case on the backend tag in Cache 2022-05-05 13:44:56 +00:00
Schema Remove RQL/Types.hs 2022-04-27 13:58:47 +00:00
SQL Fix Postgres not padding timestamps correctly (fix hasura/graphql-engine#8096) 2022-05-09 12:18:18 +00:00
Translate replace SQLOperator with ScalarSelectionArguments 2022-05-03 09:00:01 +00:00
Types server/bigquery: enable metadata API to add/drop computed fields to BigQuery tables 2022-05-04 14:53:31 +00:00
Connection.hs server: split the Postgres Connection module 2022-03-09 07:15:17 +00:00
DDL.hs Evie/postgres/module docs 2022-02-08 09:25:35 +00:00