Re: json function question

From: "David G(dot) Johnston" <david(dot)g(dot)johnston(at)gmail(dot)com>
To: Andrew Dunstan <andrew(at)dunslane(dot)net>
Cc: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>, Dan S <strd911(at)gmail(dot)com>, PostgreSQL General <pgsql-general(at)postgresql(dot)org>
Subject: Re: json function question
Date: 2016-02-24 14:41:51
Message-ID: CAKFQuwYzjSbirU_Op2jXsbJL4q6NXbG6FXLWt7yKW3_4jxJmiw@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

On Wednesday, February 24, 2016, Andrew Dunstan <andrew(at)dunslane(dot)net> wrote:

>
>
> On 02/24/2016 09:11 AM, David G. Johnston wrote:
>
>> On Wednesday, February 24, 2016, Andrew Dunstan <andrew(at)dunslane(dot)net
>> <mailto:andrew(at)dunslane(dot)net>> wrote:
>>
>>
>> Having json(b)_populate_record recursively process nested complex
>> objects would be a large undertaking. One thing to consider is
>> that json arrays are quite different from Postgres arrays: they
>> are essentially one-dimensional heterogenous lists, not
>> multi-dimensional homogeneous matrices. So while a Postgres array
>> that's been converted to a json array should in principle be
>> convertible back, an arbitrary json array could easily not be.
>>
>>
>> An arbitrary json array should be one-dimensional and homogeneous - seems
>> like that should be easy to import. The true concern is that not all
>> PostgreSQL arrays are capable of being represented in json.
>>
>
>
>
> Neither of these things are true AFAIK.
>
> 1. The following is a 100% legal json array, about as heterogenous as can
> be:
>
> [ "a" , 1, true, null, [2,false], {"b": null} ]
>
>
> 2. Having implemented the routines to convert Postgres arrays to json I'm
> not aware of any which can't be converted. Please supply an example of one
> that can't.
>
>
Yeah, I confused heterogeneous and homogeneous. That said we already only
promise best effort so if presented with a non-complex array it would be
nice to import it as part of that effort. Even if something more complex
cannot be and continues to fail.

David J.

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Adrian Klaver 2016-02-24 15:14:55 Re: Ubuntu and Rails postgresql setup
Previous Message Tom Lane 2016-02-24 14:41:17 Re: json function question