On 06/03/2014 04:45 PM, Tom Lane wrote:
> Peter Eisentraut <peter_e@gmx.net> writes:
>> This was solved back in the day for the xml type, which has essentially
>> the same requirement, by adding an ISO-8601-compatible output option to
>> EncodeDateTime(). See map_sql_value_to_xml_value() in xml.c. You ought
>> to be able to reuse that. Seems easier than routing through to_char().
> I was wondering if we didn't have another way to do that. to_char() is
> squirrely enough that I really hate having any other core functionality
> depending on it. +1 for changing this.
>
>
It's a bit of a pity neither of you spoke up in the 6 days since I
published the draft patch. And honestly, some of the other code invoked
by the XML code looks a bit squirrely too. But, OK, I will look at it. I
guess I can assume that the output won't contain anything that needs
escaping, so I can just add the leading and trailing quote marks without
needing to call escape_json().
cheers
andrew