Re: [GENERAL] Bypassing NULL elements in row_to_json function

2016-04-10 Thread Adrian Klaver
On 04/10/2016 09:24 AM, David G. Johnston wrote: On Sun, Apr 10, 2016 at 8:39 AM, Michael Nolan mailto:htf...@gmail.com>>wrote: Here's what I did: \d gold1604_test Table "uscf.gold1604_test" Column | Type | Modifiers +--+--- data | json |

Re: [GENERAL] Bypassing NULL elements in row_to_json function

2016-04-10 Thread Michael Nolan
In case it wasn't clear, the sample data was 3 rows of data. (There are actually around 890K rows in the table pgfutter built from the JSON file.) - Mike Nolan

Re: [GENERAL] Bypassing NULL elements in row_to_json function

2016-04-10 Thread David G. Johnston
On Sun, Apr 10, 2016 at 8:39 AM, Michael Nolan wrote: > Here's what I did: > > \d gold1604_test > Table "uscf.gold1604_test" > Column | Type | Modifiers > +--+--- > data | json | > > Some sample data: > {"id":"1001","name":"MISNER, J > NATHAN","st":"NY","exp":"2012-0

Re: [GENERAL] Bypassing NULL elements in row_to_json function

2016-04-10 Thread Adrian Klaver
On 04/10/2016 08:39 AM, Michael Nolan wrote: Here's what I did: \d gold1604_test Table "uscf.gold1604_test" Column | Type | Modifiers +--+--- data | json | Some sample data: {"id":"1001","name":"MISNER, J NATHAN","st":"NY","exp":"2012-05-31","sts": "A"} + {

Re: [GENERAL] Bypassing NULL elements in row_to_json function

2016-04-10 Thread Michael Nolan
Here's what I did: \d gold1604_test Table "uscf.gold1604_test" Column | Type | Modifiers +--+--- data | json | Some sample data: {"id":"1001","name":"MISNER, J NATHAN","st":"NY","exp":"2012-05-31","sts": "A"} + {"id":"1002","name":"MISNER, JUDY","st":"TN","exp

Re: [GENERAL] Bypassing NULL elements in row_to_json function

2016-04-10 Thread Adrian Klaver
On 04/10/2016 07:49 AM, Michael Nolan wrote: On Sun, Apr 10, 2016 at 2:30 AM, David G. Johnston mailto:david.g.johns...@gmail.com>> wrote: On Sat, Apr 9, 2016 at 9:48 PM, Michael Nolan mailto:htf...@gmail.com>>wrote: 2nd Followup: It turns out that loading a table from a JSON

Re: [GENERAL] Bypassing NULL elements in row_to_json function

2016-04-10 Thread David G. Johnston
On Sun, Apr 10, 2016 at 7:49 AM, Michael Nolan wrote: > > > On Sun, Apr 10, 2016 at 2:30 AM, David G. Johnston < > david.g.johns...@gmail.com> wrote: > >> On Sat, Apr 9, 2016 at 9:48 PM, Michael Nolan wrote: >> >>> >>> 2nd Followup: It turns out that loading a table from a JSON string is >>> mo

Re: [GENERAL] Bypassing NULL elements in row_to_json function

2016-04-10 Thread Michael Nolan
On Sun, Apr 10, 2016 at 2:30 AM, David G. Johnston < david.g.johns...@gmail.com> wrote: > On Sat, Apr 9, 2016 at 9:48 PM, Michael Nolan wrote: > >> >> 2nd Followup: It turns out that loading a table from a JSON string is >> more complicated than going from a table to JSON, perhaps for good reaso

Re: [GENERAL] Bypassing NULL elements in row_to_json function

2016-04-10 Thread David G. Johnston
On Sat, Apr 9, 2016 at 9:48 PM, Michael Nolan wrote: > > 2nd Followup: It turns out that loading a table from a JSON string is > more complicated than going from a table to JSON, perhaps for good reason. > There does not appear to be a direct inverse to the row_to_json() function, > but it wasn'

Re: [GENERAL] Bypassing NULL elements in row_to_json function

2016-04-09 Thread Michael Nolan
2nd Followup: It turns out that loading a table from a JSON string is more complicated than going from a table to JSON, perhaps for good reason. There does not appear to be a direct inverse to the row_to_json() function, but it wasn't difficult for me to write a PHP program that takes the JSON fil

Re: [GENERAL] Bypassing NULL elements in row_to_json function

2016-04-09 Thread Michael Nolan
I was able to try it on a test server, the combination of row_to_json() and json_strip_nulls() worked exactly as I had hoped. Stripping nulls reduced the JSON file by over 50%. (The data I needed to export has around 900,000 rows, so it gets quite large.) I've got a test file I can make available

Re: [GENERAL] Bypassing NULL elements in row_to_json function

2016-04-08 Thread Michael Nolan
It looks like json_strip_nulls() may be what I need, I'm currently on 9.3, which doesn't have that function but may be in a position to upgrade to 9.5 this summer. I think the apps that would be receiving the data can deal with any resulting 'holes' in the data set by just setting them to null. -

Re: [GENERAL] Bypassing NULL elements in row_to_json function

2016-04-08 Thread Adrian Klaver
On 04/08/2016 08:31 AM, Michael Nolan wrote: I'm looking at the possibility of using JSON as a data exchange format with some apps running on both PCs and Macs. . The table I would be exporting has a lot of NULL values in it. Is there any way to skip the NULL values in the row_to_json functio

Re: [GENERAL] Bypassing NULL elements in row_to_json function

2016-04-08 Thread David G. Johnston
On Fri, Apr 8, 2016 at 8:53 AM, Raymond O'Donnell wrote: > On 08/04/2016 16:31, Michael Nolan wrote: > > I'm looking at the possibility of using JSON as a data exchange format > > with some apps running on both PCs and Macs. . > > > > The table I would be exporting has a lot of NULL values in i

Re: [GENERAL] Bypassing NULL elements in row_to_json function

2016-04-08 Thread Raymond O'Donnell
On 08/04/2016 16:31, Michael Nolan wrote: > I'm looking at the possibility of using JSON as a data exchange format > with some apps running on both PCs and Macs. . > > The table I would be exporting has a lot of NULL values in it. Is > there any way to skip the NULL values in the row_to_json fu

[GENERAL] Bypassing NULL elements in row_to_json function

2016-04-08 Thread Michael Nolan
I'm looking at the possibility of using JSON as a data exchange format with some apps running on both PCs and Macs. . The table I would be exporting has a lot of NULL values in it. Is there any way to skip the NULL values in the row_to_json function and include only the fields that are non-null