Re: Extract numeric filed in JSONB more effectively

From: jian he <jian(dot)universality(at)gmail(dot)com>
To: Andy Fan <zhihui(dot)fan1213(at)gmail(dot)com>
Cc: Chapman Flack <chap(at)anastigmatix(dot)net>, Pavel Stehule <pavel(dot)stehule(at)gmail(dot)com>, Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>, pgsql-hackers <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: Extract numeric filed in JSONB more effectively
Date: 2023-09-05 12:51:01
Message-ID: CACJufxGNpzCVKVXt-1nTVv0UCX6sj2MAdnYedHofORNjv0TYcg@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On Mon, Sep 4, 2023 at 10:35 PM Andy Fan <zhihui(dot)fan1213(at)gmail(dot)com> wrote:
>
> Hi,
>
> v13 attached. Changes includes:
>
> 1. fix the bug Jian provides.
> 2. reduce more code duplication without DirectFunctionCall.
> 3. add the overlooked jsonb_path_query and jsonb_path_query_first as candidates
>
>
> --
> Best Regards
> Andy Fan

based on v13.
IMHO, it might be a good idea to write some comments on
jsonb_object_field_internal. especially the second boolean argument.
something like "some case, we just want return JsonbValue rather than
Jsonb. to return JsonbValue, make as_jsonb be false".

I am not sure "jsonb_object_field_start" is a good name, so far I only
come up with "jsonb_object_field_to_jsonbvalues".

linitial(jsonb_start_func->args) =
makeRelabelType(linitial(jsonb_start_func->args),
INTERNALOID, 0,
InvalidOid,
COERCE_IMPLICIT_CAST);

if no need, output typmod (usually -1), so here should be -1 rather than 0?

list_make2(jsonb_start_func, makeConst(.....). you can just combine
two different types then make a list, seems pretty cool...

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Aleksander Alekseev 2023-09-05 13:04:46 Re: XLog size reductions: smaller XLRec block header for PG17
Previous Message Dilip Kumar 2023-09-05 12:30:41 Re: persist logical slots to disk during shutdown checkpoint