1
0
mirror of https://github.com/postgres/postgres.git synced 2025-07-30 11:03:19 +03:00

Use ISO 8601 format for dates converted to JSON, too.

Commit f30015b6d7 made this happen for
timestamp and timestamptz, but it seems pretty inconsistent to not
do it for simple dates as well.

(In passing, I re-pgindent'd json.c.)
This commit is contained in:
Tom Lane
2014-08-17 22:57:20 -04:00
parent 3b2f4aa0f0
commit 560e2300b2
2 changed files with 48 additions and 14 deletions

View File

@ -120,7 +120,7 @@
<listitem>
<para>
When converting values of type <type>timestamp</>
When converting values of type <type>date</>, <type>timestamp</>
or <type>timestamptz</>
to <link linkend="datatype-json"><type>JSON</type></link>, render the
values in a format compliant with ISO 8601 (Andrew Dunstan)
@ -129,7 +129,10 @@
<para>
Previously such values were rendered according to the current
<xref linkend="guc-datestyle"> setting; but many JSON processors
require timestamps to be in ISO 8601 format.
require timestamps to be in ISO 8601 format. If necessary, the
previous behavior can be obtained by explicitly casting the datetime
value to <type>text</> before passing it to the JSON conversion
function.
</para>
</listitem>