Re: Extract numeric filed in JSONB more effectively

Andy Fan <zhihui.fan1213@gmail.com>

From: Andy Fan <zhihui.fan1213@gmail.com>
To: Chapman Flack <chap@anastigmatix.net>
Cc: jian he <jian.universality@gmail.com>, Pavel Stehule <pavel.stehule@gmail.com>, Tom Lane <tgl@sss.pgh.pa.us>, pgsql-hackers <pgsql-hackers@postgresql.org>
Date: 2023-09-15T01:53:20Z
Lists: pgsql-hackers

Attachments

> Is there a reason not to transform the _tz flavors of
>> jsonb_path_query and jsonb_path-query_first?
>>
>
> I misunderstood the _tz flavors return timestamp,  after some deep
> reading of these functions, they just work at the comparisons part.
> so I will add them in the following version.
>

_tz favors did return timestamp..  the reason is stated in the commit
 messge of patch 2.

try to apply jsonb extraction optimization to  _tz functions.

both jsonb_path_query_tz and jsonb_path_query_tz_first returns
the elements which are timestamp comparable, but such elements
are impossible to be cast to numeric or boolean IIUC. Just provides
this commit for communication purpose only.

so v14 is attached, changes include:
1. Change the typmod for internal type from 0 to -1.
2. return NULL for non-simplify expressions from the planner
support function, hence shallow copy is removed as well.

Things are not addressed yet:
1.  the error message handling.
2.  if we have chances to optimize _tz functions, I guess no.
3.  function naming issue. I think I can get it modified once after
all the other issues are addressed.

-- 
Best Regards
Andy Fan

Commits

Same data as JSON: GET /api/v1/messages/:b64id/commits the thread's linked commits as JSON, with link sources. API reference →
  1. Add trailing commas to enum definitions