Re: JSON NULLs

From: Yeb Havinga <yebhavinga(at)gmail(dot)com>
To: Andrew Dunstan <andrew(at)dunslane(dot)net>
Cc: PostgreSQL-development Hackers <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: JSON NULLs
Date: 2013-02-11 08:21:29
Message-ID: 5118AA09.6000104@gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On 2013-02-10 16:03, Andrew Dunstan wrote:
> On 02/10/2013 05:43 AM, Yeb Havinga wrote:
>> 3. I was wondering how to access the first author from this json
>> snippet:
>>
>> {
>> "id": "QZr82w_eSi8C",
>> "etag": "KZ+JsrkCdqw",
>> "volumeInfo": {
>> "title": "Heads Up Software Construction",
>> "authors": [
>> "Dan Malone",
>> "Dave Riles"
>> ],
>>
>>
>
> try:
>
> json_get_path_as_text(document, 'volumeInfo', 'authors', '0')
>
>
> There are other ways to spell this, too:
>
> json_get_path_as_text(document, variadic
> '{volumeInfo,authors,0}'::text[])
>
>
> or
>
> document->>'{volumeInfo,authors,0}'::text[]

That works very nice, thanks!
>
> I'm actually wondering if we should use different operator names for
> the get_path*op functions so we wouldn't need to type qualify the path
> argument. Maybe ?> and ?>> although I'm reluctant to use ? in an
> operator given the recent JDBC discussion. Or perhaps #> and #>>.

different operator name: +1.

thanks
Yeb

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Pavan Deolasee 2013-02-11 08:46:08 Re: Too frequent checkpoints ?
Previous Message Jeevan Chalke 2013-02-11 06:44:26 Re: unlogged tables vs. GIST