pgsql: Use EncodeDateTime instead of to_char to render JSON timestamps.

From: Andrew Dunstan <andrew(at)dunslane(dot)net>
To: pgsql-committers(at)postgresql(dot)org
Subject: pgsql: Use EncodeDateTime instead of to_char to render JSON timestamps.
Date: 2014-06-03 22:35:54
Message-ID: [email protected]
Views: Whole Thread | Raw Message | Download mbox | Resend email
Thread:
Lists: pgsql-committers

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

Branch
------
master

Details
-------
http://git.postgresql.org/pg/commitdiff/ab14a73a6ca5cc4750f0e00a48bdc25a2293034a

Modified Files
--------------
src/backend/utils/adt/json.c | 77 ++++++++++++++++++++++------------
src/test/regress/expected/json.out | 6 +--
src/test/regress/expected/json_1.out | 6 +--
3 files changed, 56 insertions(+), 33 deletions(-)

Browse pgsql-committers by date

  From Date Subject
Next Message Peter Eisentraut 2014-06-04 03:09:40 pgsql: Silence Bison deprecation warnings
Previous Message Andrew Dunstan 2014-06-03 20:18:35 pgsql: Do not escape a unicode sequence when escaping JSON text.