Use EncodeDateTime instead of to_char to render JSON timestamps.
Andrew Dunstan <andrew@dunslane.net>
Use EncodeDateTime instead of to_char to render JSON timestamps. Per gripe from Peter Eisentraut and Tom Lane. The output is slightly different, but still ISO 8601 compliant: to_char doesn't output the minutes when time zone offset is an integer number of hours, while EncodeDateTime outputs ":00". The code is slightly adapted from code in xml.c
Files
| Path | Change | +/− |
|---|---|---|
| src/backend/utils/adt/json.c | modified | +50 −27 |
| src/test/regress/expected/json_1.out | modified | +3 −3 |
| src/test/regress/expected/json.out | modified | +3 −3 |