Re: [HACKERS] Calling json_* functions with JSONB data

2016-05-24 Thread Jim Nasby
On 5/23/16 4:45 PM, David G. Johnston wrote: On Mon, May 23, 2016 at 5:38 PM, Jim Nasby mailto:jim.na...@bluetreble.com>>wrote: On 5/23/16 11:55 AM, Peter van Hardenberg wrote: Fortunately, this seems quite easy to resolve by taking advantage of our ability to add js

Re: [HACKERS] Calling json_* functions with JSONB data

2016-05-23 Thread David G. Johnston
On Mon, May 23, 2016 at 5:38 PM, Jim Nasby wrote: > On 5/23/16 11:55 AM, Peter van Hardenberg wrote: > >> Fortunately, this seems quite easy to resolve by taking advantage of our >> ability to add json_*(jsonb) form of the functions. >> > > Another issue no one has mentioned is functions that ret

Re: [HACKERS] Calling json_* functions with JSONB data

2016-05-23 Thread Jim Nasby
On 5/23/16 11:55 AM, Peter van Hardenberg wrote: Fortunately, this seems quite easy to resolve by taking advantage of our ability to add json_*(jsonb) form of the functions. Another issue no one has mentioned is functions that return JSON/JSONB. IMO those should NOT be overloaded, because that

Re: [HACKERS] Calling json_* functions with JSONB data

2016-05-23 Thread David G. Johnston
On Mon, May 23, 2016 at 4:37 PM, Tom Lane wrote: > Peter van Hardenberg writes: > > Great question, Marko. If you can point me towards an example I'll take a > > look, but I'll proceed with the current understanding and suggestions and > > see what people have to say. > > I believe Marko's just

Re: [HACKERS] Calling json_* functions with JSONB data

2016-05-23 Thread Peter van Hardenberg
I'll look into it, thanks for the explanation. On Mon, May 23, 2016 at 1:37 PM, Tom Lane wrote: > Peter van Hardenberg writes: > > Great question, Marko. If you can point me towards an example I'll take a > > look, but I'll proceed with the current understanding and suggestions and > > see what

Re: [HACKERS] Calling json_* functions with JSONB data

2016-05-23 Thread Tom Lane
Peter van Hardenberg writes: > Great question, Marko. If you can point me towards an example I'll take a > look, but I'll proceed with the current understanding and suggestions and > see what people have to say. I believe Marko's just complaining about the case for unknown-type arguments, for exa

Re: [HACKERS] Calling json_* functions with JSONB data

2016-05-23 Thread Peter van Hardenberg
Great question, Marko. If you can point me towards an example I'll take a look, but I'll proceed with the current understanding and suggestions and see what people have to say. On Mon, May 23, 2016 at 10:47 AM, Marko Tiikkaja wrote: > On 2016-05-23 18:55, Peter van Hardenberg wrote: > >> I talke

Re: [HACKERS] Calling json_* functions with JSONB data

2016-05-23 Thread Tom Lane
Marko Tiikkaja writes: > On 2016-05-23 18:55, Peter van Hardenberg wrote: >> Anyone have any concerns or suggestions? > What about cases like json_whatever($1) which previously worked but > will now be ambiguous? (Or will they somehow not be ambiguous?) Good point, that would have to be look

Re: [HACKERS] Calling json_* functions with JSONB data

2016-05-23 Thread Marko Tiikkaja
On 2016-05-23 18:55, Peter van Hardenberg wrote: I talked this over with Andrew who had no objections and suggested I float it on the list before writing a patch. Looks pretty straightforward, just a few new data rows in pg_proc.h. Anyone have any concerns or suggestions? What about cases like

Re: [HACKERS] Calling json_* functions with JSONB data

2016-05-23 Thread Tom Lane
Peter van Hardenberg writes: > I talked this over with Andrew who had no objections and suggested I float > it on the list before writing a patch. Looks pretty straightforward, just a > few new data rows in pg_proc.h. I think you might find that you need to add new C function entry points to keep

Re: [HACKERS] Calling json_* functions with JSONB data

2016-05-23 Thread Ryan Pedela
On Mon, May 23, 2016 at 11:14 AM, David G. Johnston < david.g.johns...@gmail.com> wrote: > On Mon, May 23, 2016 at 12:55 PM, Peter van Hardenberg wrote: > >> Hi there, >> >> I noticed it was very easy to accidentally call the json_* form of JSON >> manipulation functions with jsonb data as input.

Re: [HACKERS] Calling json_* functions with JSONB data

2016-05-23 Thread David G. Johnston
On Mon, May 23, 2016 at 12:55 PM, Peter van Hardenberg wrote: > Hi there, > > I noticed it was very easy to accidentally call the json_* form of JSON > manipulation functions with jsonb data as input. This is pretty > sub-optimal, since it involves rendering the jsonb then reparsing it and > call

[HACKERS] Calling json_* functions with JSONB data

2016-05-23 Thread Peter van Hardenberg
Hi there, I noticed it was very easy to accidentally call the json_* form of JSON manipulation functions with jsonb data as input. This is pretty sub-optimal, since it involves rendering the jsonb then reparsing it and calling the json_* form of the function. Fortunately, this seems quite easy to