Skip site navigation (1) Skip section navigation (2)

Re: is JSON really "a type" (Re: data to json enhancements)

From: Hannu Krosing <hannu(at)krosing(dot)net>
To: Andrew Dunstan <andrew(at)dunslane(dot)net>
Cc: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>, PostgreSQL-development <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: is JSON really "a type" (Re: data to json enhancements)
Date: 2012-10-01 07:11:24
Message-ID: 5069421C.2090202@krosing.net (view raw or flat)
Thread:
Lists: pgsql-hackers
On 09/29/2012 10:29 PM, Andrew Dunstan wrote:
>
> On 09/29/2012 05:01 PM, Hannu Krosing wrote:
>> On 09/29/2012 05:40 PM, Andrew Dunstan wrote:
>>>
>>> I still think Tom's suggestion is the best and simplest way to do that.
>> which Toms suggestion you mean here ?
>>
>> The 3. mentioned above was for making possible 2 separate ways to 
>> convert (serialise/quote/escape and parse/check-for-valid-json) 
>> string to json and afair not about hstore to json.
>
> Er, what? yes, I meant option 3, and it is a perfect mechanism for 
> doing conversion of an hstore field inside datum_to_json: the code 
> would look for a cast to the new type (whatever we call it) and use 
> that instead of the normal text representation.
The only place where the new type is needed is text to json conversion, 
for all others cast to the main json type should be enough.

Or do you mean to still do it as a generic cast to "json_component" type 
so it would be usable for text types as well ?

>
>>
>> I'm also looking forward for an easy way or two to populate a record 
>> from json and extract an array from json.
>
>
> I am prepared to take this on - at least starting with json to array 
> which I think is the simpler case. I have some ideas about how to do 
> this and have done a bit of experimental work along these lines. 
> Personally I'd be inclined to make it do a conversion to text[] and 
> then cast from that to anything else we needed.
>
> cheers
>
> andrew
>
>
>



In response to

Responses

pgsql-hackers by date

Next:From: Nozomi AnzaiDate: 2012-10-01 07:28:16
Subject: Re: 64-bit API for large object
Previous:From: Heikki LinnakangasDate: 2012-10-01 06:24:39
Subject: Re: doc patch for increase in shared_buffers

Privacy Policy | About PostgreSQL
Copyright © 1996-2014 The PostgreSQL Global Development Group