Re: json casts - Mailing list pgsql-hackers

From Andrew Dunstan
Subject Re: json casts
Date
Msg-id 538E4459.1040602@dunslane.net
Whole thread Raw
In response to Re: json casts  (Tom Lane <tgl@sss.pgh.pa.us>)
List pgsql-hackers
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




pgsql-hackers by date:

Previous
From: Alvaro Herrera
Date:
Subject: Re: idle_in_transaction_timeout
Next
From: Andrew Dunstan
Date:
Subject: Re: idle_in_transaction_timeout