Re: [HACKERS] JSON[B] arrays are second-class citizens

2016-06-01 Thread Pavel Stehule
2016-06-01 17:55 GMT+02:00 Jim Nasby : > On 5/31/16 7:04 PM, Peter van Hardenberg wrote: > >> The idea of converting a JSONB array to a PG array is appealing and >> would potentially be more general-purpose than adding a new unnest. I'm >> not sure how feasible either

Re: [HACKERS] JSON[B] arrays are second-class citizens

2016-06-01 Thread David Fetter
On Tue, May 31, 2016 at 06:15:32PM -0400, David G. Johnston wrote: > I stand corrected. I was thinking you could somehow craft unnest(' value here>') but there is no way to auto-convert to "anyarray"... > > > The json_array_elements family manages to do the right thing. Why > > would it be

Re: [HACKERS] JSON[B] arrays are second-class citizens

2016-06-01 Thread David G. Johnston
On Tue, May 31, 2016 at 6:20 PM, Tom Lane wrote: > David Fetter writes: > > On Tue, May 31, 2016 at 05:06:00PM -0400, David G. Johnston wrote: > >> While likely not that common the introduction of an ambiguity makes > >> raises the bar considerably. > > >

Re: [HACKERS] JSON[B] arrays are second-class citizens

2016-06-01 Thread David G. Johnston
On Wed, Jun 1, 2016 at 11:55 AM, Jim Nasby wrote: > On 5/31/16 7:04 PM, Peter van Hardenberg wrote: > >> The idea of converting a JSONB array to a PG array is appealing and >> would potentially be more general-purpose than adding a new unnest. I'm >> not sure how

Re: [HACKERS] JSON[B] arrays are second-class citizens

2016-06-01 Thread Jim Nasby
On 5/31/16 7:04 PM, Peter van Hardenberg wrote: The idea of converting a JSONB array to a PG array is appealing and would potentially be more general-purpose than adding a new unnest. I'm not sure how feasible either suggestion is. The one part I think is missing right now is unnest allows you

Re: [HACKERS] JSON[B] arrays are second-class citizens

2016-06-01 Thread David Fetter
On Tue, May 31, 2016 at 06:20:26PM -0400, Tom Lane wrote: > David Fetter writes: > > On Tue, May 31, 2016 at 05:06:00PM -0400, David G. Johnston wrote: > >> While likely not that common the introduction of an ambiguity makes > >> raises the bar considerably. > > > What

Re: [HACKERS] JSON[B] arrays are second-class citizens

2016-05-31 Thread Peter van Hardenberg
The idea of converting a JSONB array to a PG array is appealing and would potentially be more general-purpose than adding a new unnest. I'm not sure how feasible either suggestion is. I will say that I think the current state of affairs is gratuitously verbose and expects users to memorize a

Re: [HACKERS] JSON[B] arrays are second-class citizens

2016-05-31 Thread Tom Lane
David Fetter writes: > On Tue, May 31, 2016 at 05:06:00PM -0400, David G. Johnston wrote: >> While likely not that common the introduction of an ambiguity makes >> raises the bar considerably. > What ambiguity? My first thought about it was that select unnest('{1,2,3}');

Re: [HACKERS] JSON[B] arrays are second-class citizens

2016-05-31 Thread David G. Johnston
On Tue, May 31, 2016 at 5:46 PM, David Fetter wrote: > On Tue, May 31, 2016 at 05:06:00PM -0400, David G. Johnston wrote: > > On Tue, May 31, 2016 at 4:34 PM, David Fetter wrote: > > > > > Folks, > > > > > > While querying some JSONB blobs at work in

Re: [HACKERS] JSON[B] arrays are second-class citizens

2016-05-31 Thread David Fetter
On Tue, May 31, 2016 at 05:06:00PM -0400, David G. Johnston wrote: > On Tue, May 31, 2016 at 4:34 PM, David Fetter wrote: > > > Folks, > > > > While querying some JSONB blobs at work in preparation for a massive > > rework of the data infrastructure, I ran into things that

Re: [HACKERS] JSON[B] arrays are second-class citizens

2016-05-31 Thread Corey Huinker
On Tue, May 31, 2016 at 5:06 PM, David G. Johnston < david.g.johns...@gmail.com> wrote: > On Tue, May 31, 2016 at 4:34 PM, David Fetter wrote: > >> Folks, >> >> While querying some JSONB blobs at work in preparation for a massive >> rework of the data infrastructure, I ran into

Re: [HACKERS] JSON[B] arrays are second-class citizens

2016-05-31 Thread David G. Johnston
On Tue, May 31, 2016 at 4:34 PM, David Fetter wrote: > Folks, > > While querying some JSONB blobs at work in preparation for a massive > rework of the data infrastructure, I ran into things that really > puzzled me, to wit: > > SELECT * FROM unnest('["a","b","c"]'::jsonb); >

[HACKERS] JSON[B] arrays are second-class citizens

2016-05-31 Thread David Fetter
Folks, While querying some JSONB blobs at work in preparation for a massive rework of the data infrastructure, I ran into things that really puzzled me, to wit: SELECT * FROM unnest('["a","b","c"]'::jsonb); ERROR: function unnest(jsonb) does not exist SELECT * FROM