Re: jsonb generator functions - Mailing list pgsql-hackers

From Andrew Dunstan
Subject Re: jsonb generator functions
Date
Msg-id 545D01D1.3090008@dunslane.net
Whole thread Raw
In response to Re: jsonb generator functions  (Andrew Dunstan <andrew@dunslane.net>)
Responses Re: jsonb generator functions  (Alvaro Herrera <alvherre@2ndquadrant.com>)
List pgsql-hackers
On 10/28/2014 09:49 AM, Andrew Dunstan wrote:
>
> On 10/27/2014 05:57 PM, Alvaro Herrera wrote:
>
>> Anyway this whole business of searching through the CASTSOURCETARGET
>> syscache seems like it could be refactored.  If I'm counting correctly,
>> that block now appears four times (three in this patch, once in json.c).
>> Can't we add a new function to (say) lsyscache and remove that?
>
> Twice, not three times in this patch, unless I'm going crazier than I
> thought.
>
> I can add a function to lsyscache along the lines of
>
>     Oid get_cast_func(Oid from_type, Oid to_type)
>
> if you think it's worth it.
>
>


OK, here is a new patch version that

  * uses find_coercion_path() to find the cast function if any, as
    discussed elsewhere
  * removes calls to getTypeOutputInfo() except where required
  * honors a cast to json only for rendering both json and jsonb
  * adds processing for the date type that was previously missing in
    datum_to_jsonb

cheers

andrew



Attachment

pgsql-hackers by date:

Previous
From: Petr Jelinek
Date:
Subject: Re: tracking commit timestamps
Next
From: Josh Berkus
Date:
Subject: Re: recovery_target_time and standby_mode