Re: [HACKERS] jsonb generator functions

2014-12-12 Thread Andrew Dunstan
On 12/08/2014 01:00 PM, Andrew Dunstan wrote: On 12/08/2014 04:21 AM, Alvaro Herrera wrote: Andrew Dunstan wrote: 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

Re: [HACKERS] jsonb generator functions

2014-12-12 Thread Andrew Dunstan
On 12/12/2014 01:10 PM, Andrew Dunstan wrote: On 12/08/2014 01:00 PM, Andrew Dunstan wrote: On 12/08/2014 04:21 AM, Alvaro Herrera wrote: Andrew Dunstan wrote: OK, here is a new patch version that * uses find_coercion_path() to find the cast function if any, as discussed elsewhere

Re: [HACKERS] jsonb generator functions

2014-12-12 Thread Tom Lane
Andrew Dunstan and...@dunslane.net writes: Also here is a patch factored out which applies the find_coercion_pathway change to json.c. I'm inclined to say we should backpatch this to 9.4 (and with a small change 9.3). Thoughts? Meh. Maybe I'm just feeling gunshy because I broke something

Re: [HACKERS] jsonb generator functions

2014-12-12 Thread Andrew Dunstan
On 12/12/2014 01:55 PM, Tom Lane wrote: Andrew Dunstan and...@dunslane.net writes: Also here is a patch factored out which applies the find_coercion_pathway change to json.c. I'm inclined to say we should backpatch this to 9.4 (and with a small change 9.3). Thoughts? Meh. Maybe I'm just

Re: [HACKERS] jsonb generator functions

2014-12-08 Thread Alvaro Herrera
Andrew Dunstan wrote: 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

Re: [HACKERS] jsonb generator functions

2014-12-08 Thread Andrew Dunstan
On 12/08/2014 04:21 AM, Alvaro Herrera wrote: Andrew Dunstan wrote: 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

Re: [HACKERS] jsonb generator functions

2014-11-07 Thread Andrew Dunstan
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,

Re: [HACKERS] jsonb generator functions

2014-10-28 Thread Alvaro Herrera
Andrew Dunstan wrote: This bit: +/* + * Determine how we want to render values of a given type in datum_to_jsonb. + * + * Given the datatype OID, return its JsonbTypeCategory, as well as the type's + * output function OID. If the returned category is JSONBTYPE_CAST, we + * return the

Re: [HACKERS] jsonb generator functions

2014-10-28 Thread Andrew Dunstan
On 10/27/2014 05:57 PM, Alvaro Herrera wrote: Andrew Dunstan wrote: This bit: +/* + * Determine how we want to render values of a given type in datum_to_jsonb. + * + * Given the datatype OID, return its JsonbTypeCategory, as well as the type's + * output function OID. If the returned

Re: [HACKERS] jsonb generator functions

2014-10-27 Thread Andrew Dunstan
On 10/15/2014 03:54 PM, Andrew Dunstan wrote: I checked a code, and I have only two small objection - a name jsonb_object_two_arg is not good - maybe json_object_keys_values ? It's consistent with the existing json_object_two_arg. In all cases I think I kept the names the same except for

Re: [HACKERS] jsonb generator functions

2014-10-27 Thread Pavel Stehule
Hi 2014-10-27 15:33 GMT+01:00 Andrew Dunstan and...@dunslane.net: On 10/15/2014 03:54 PM, Andrew Dunstan wrote: I checked a code, and I have only two small objection - a name jsonb_object_two_arg is not good - maybe json_object_keys_values ? It's consistent with the existing

Re: [HACKERS] jsonb generator functions

2014-10-16 Thread Pavel Stehule
2014-10-15 23:49 GMT+02:00 Andrew Dunstan and...@dunslane.net: On 10/15/2014 05:47 PM, Alvaro Herrera wrote: Andrew Dunstan wrote: If we really want to change the name of json_object_two_arg, it would probably be best to change it NOW in 9.4 before it gets out into a production release

Re: [HACKERS] jsonb generator functions

2014-10-15 Thread Pavel Stehule
2014-10-13 17:22 GMT+02:00 Andrew Dunstan and...@dunslane.net: On 10/13/2014 09:37 AM, Andrew Dunstan wrote: On 09/26/2014 04:54 PM, Andrew Dunstan wrote: Here is a patch for the generator and aggregate functions for jsonb that we didn't manage to get done in time for 9.4. They are all

Re: [HACKERS] jsonb generator functions

2014-10-15 Thread Andrew Dunstan
On 10/15/2014 07:38 AM, Pavel Stehule wrote: 2014-10-13 17:22 GMT+02:00 Andrew Dunstan and...@dunslane.net mailto:and...@dunslane.net: On 10/13/2014 09:37 AM, Andrew Dunstan wrote: On 09/26/2014 04:54 PM, Andrew Dunstan wrote: Here is a patch for the generator

Re: [HACKERS] jsonb generator functions

2014-10-15 Thread Andrew Dunstan
On 10/15/2014 03:54 PM, I wrote: On 10/15/2014 07:38 AM, Pavel Stehule wrote: I checked a code, and I have only two small objection - a name jsonb_object_two_arg is not good - maybe json_object_keys_values ? It's consistent with the existing json_object_two_arg. In all cases I think I

Re: [HACKERS] jsonb generator functions

2014-10-15 Thread Alvaro Herrera
Andrew Dunstan wrote: If we really want to change the name of json_object_two_arg, it would probably be best to change it NOW in 9.4 before it gets out into a production release at all. Doesn't it require initdb? If so, I think it's too late now. -- Álvaro Herrera

Re: [HACKERS] jsonb generator functions

2014-10-15 Thread Andrew Dunstan
On 10/15/2014 05:47 PM, Alvaro Herrera wrote: Andrew Dunstan wrote: If we really want to change the name of json_object_two_arg, it would probably be best to change it NOW in 9.4 before it gets out into a production release at all. Doesn't it require initdb? If so, I think it's too late

Re: [HACKERS] jsonb generator functions

2014-10-13 Thread Andrew Dunstan
On 09/26/2014 04:54 PM, Andrew Dunstan wrote: Here is a patch for the generator and aggregate functions for jsonb that we didn't manage to get done in time for 9.4. They are all equivalents of the similarly names json functions. Included are to_jsonb jsonb_build_object

Re: [HACKERS] jsonb generator functions

2014-10-13 Thread Andrew Dunstan
On 10/13/2014 09:37 AM, Andrew Dunstan wrote: On 09/26/2014 04:54 PM, Andrew Dunstan wrote: Here is a patch for the generator and aggregate functions for jsonb that we didn't manage to get done in time for 9.4. They are all equivalents of the similarly names json functions. Included are

[HACKERS] jsonb generator functions

2014-09-26 Thread Andrew Dunstan
Here is a patch for the generator and aggregate functions for jsonb that we didn't manage to get done in time for 9.4. They are all equivalents of the similarly names json functions. Included are to_jsonb jsonb_build_object jsonb_build_array jsonb_object jsonb_agg

Re: [HACKERS] jsonb generator functions

2014-09-26 Thread Peter Geoghegan
On Fri, Sep 26, 2014 at 1:54 PM, Andrew Dunstan and...@dunslane.net wrote: Here is a patch for the generator and aggregate functions for jsonb that we didn't manage to get done in time for 9.4. That's cool, but I hope someone revisits adding a concatenate operator. That's a biggest omission

Re: [HACKERS] jsonb generator functions

2014-09-26 Thread Andrew Dunstan
On 09/26/2014 05:00 PM, Peter Geoghegan wrote: On Fri, Sep 26, 2014 at 1:54 PM, Andrew Dunstan and...@dunslane.net wrote: Here is a patch for the generator and aggregate functions for jsonb that we didn't manage to get done in time for 9.4. That's cool, but I hope someone revisits adding a