Postgres will return TIMESTAMPTZ values using inconsistent formats, depending on how many zeros are after the .
See these examples:
2020-10-24 13:21:05+10
2020-10-24 13:21:05.1+10
2020-10-24 13:21:05.12+10
2020-10-24 13:21:05.123+10
2020-10-24 13:21:05.1234+10
2020-10-24 13:21:05.12345+10
2020-10-24 13:21:05.123456+10
It also does the same with the offset, e.g.
2020-10-24 13:21:05.123456+10
2020-10-24 13:21:05.123456+1030
Is there any way to have postgres just return the exact same format at all times? i.e. With 6 digits after the .
for sub-seconds, and 4 digits for the timezone offset?
...but without actually needing to edit every query to manually format the output. I'm after a database/connection/session/global setting that does it for everything.
I came across the DateStyle
setting - it doesn't seem to let me control this.