Re: Proposal: json_populate_record and nested json objects

From: Merlin Moncure <mmoncure(at)gmail(dot)com>
To: Chris Travers <chris(at)2ndquadrant(dot)com>
Cc: PostgreSQL-development <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: Proposal: json_populate_record and nested json objects
Date: 2013-09-16 14:18:04
Message-ID: CAHyXU0zE5YMqnYzScKvJEQewD2E_hu9V8ZirO87wwBqqu22yag@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On Mon, Sep 16, 2013 at 8:57 AM, Chris Travers <chris(at)2ndquadrant(dot)com> wrote:
>> On 16 September 2013 at 14:43 Merlin Moncure <mmoncure(at)gmail(dot)com> wrote:
>
>>
>> Huge +1 on on this. Couple random thoughts:
>>
>> *) Hard to see how you would structure this as an extension as you're
>> adjusting the behaviors of existing functions, unless you wanted to
>> introduce new function names for testing purposes?
>
> Yeah, and reading the source, it looks like some parts of the JSON parsing
> code will have to be rewritten because the nested object errors are thrown
> quite deeply in the parsing stage. It looks to me as if this will require
> some significant copying as a POC into a new file with different publicly
> exposed function names.

ISTM that's not worth it then.

>> *) Would like to at least consider being able to use casting syntax as
>> a replacement for "populate_record" and (the missing) "populate_array"
>> for most usages.
>
> Yes. I am trying to figure out how best to do this at present. Initially I
> think I would be happy to settle for casts wrapping functions which
> themselves just wrap the call to populate_record.

right.

> What I will probably do for my POC is expose the following methods:
>
> 1. json_populate_type()

hm if you're going to name it that way, prefer json_populate_value().
(or maybe _scalar() or _datum()). but we have to_json(), so how about
from_json()?

merlin

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Andres Freund 2013-09-16 14:28:23 Re: record identical operator
Previous Message Kevin Grittner 2013-09-16 14:01:01 Re: record identical operator