HomePhabricator

Fix TS_POSTGRES to match PostgreSQL's actual output

Tags
None
Referenced Files
None
Subscribers
None

Description

Fix TS_POSTGRES to match PostgreSQL's actual output

PostgreSQL, as far back as 7.1,[1] has documented that its default ISO
format looks like "1997-12-17 07:37:16+00". But for some reason the code
here was generating "1997-12-17 07:37:16 GMT" instead.

That worked ok for inserting, since PG is liberal in the date formats it
accepts. But it breaks if we try to test a timestamp in a row fetched
from the database by using TS_POSTGRES in the "expected" row rather than
reformatting each timestamp field in each "actual" row.

There's no change to the input code, since both formats were already
accepted. In fact the original MediaWiki patch adding TS_POSTGRES
(ef047e87, r15716) supported only the correct format as input; the
ability to correctly round-trip wasn't added until several months later
(3f1dc32b, r17766).

[1]: https://www.postgresql.org/docs/7.1/static/datatype-datetime.html#AEN3279

Bug: T195807
Change-Id: If5e4b0049fce4226605e081650ee6a2202184c65

Details

Provenance
AnomieAuthored on Sep 10 2018, 6:22 PM
Parents
R1985:c33298290928: Introduce a mock clock in ConvertibleTimestamp.
Branches
Unknown
Tags
Unknown
References
tag: v2.1.1, refs/changes/01/459601/1
ChangeId
If5e4b0049fce4226605e081650ee6a2202184c65