Jsonb array-style subscripting, generic version - Mailing list pgsql-hackers

From Dmitry Dolgov
Subject Jsonb array-style subscripting, generic version
Date
Msg-id CA+q6zcVzfhNXnMZATgd7UOFPP2By_B_ciMJw8ETvezSnn5bZKg@mail.gmail.com
Whole thread Raw
List pgsql-hackers
Hi

With regard to previous conversations:



I want to try following approach to make the array-style subscripting more
generic and allow using it for different types with less effort:

* Introduce generic node type instead of the `ArrayRef` (and `JsonbRef` from
  patch) [SubscriptingRef]
* Make generic version of `transformArraySubscript` /
  `transformAssignmentSubscript` / `ExecEvalArrayRef` etc
  [transformSubscripting / ExecEvalSubscripting etc]
* Introduce a new pg_type column with type `regproc` to point out a function to
  handle all type-related logic for generic `ExecEval` function
  [typsubscripting]. If value of this column is null, type doesn't support
  array-style subscripting

There is still question about indexing of such kind of expressions. To be
honest I haven't figured it out in details yet how to do it (except simple
btree index for an each path like `create index jsonb_data_idx on jsonb_table ((jsonb_data['key']))`).
But I believe that this can be achieved subsequently, since in case of getting
data using the array-style subscripting it's no more than alias or syntactic
sugar.

So I have few questions:

* Is it whole plan looks ok?
* Any suggestions about names (especially for column in pg_type)?  
* Is it ok to implement indexing separately (since the main purpose of
  array-style subscripting for jsonb is an update operation)?

pgsql-hackers by date:

Previous
From: Jeff Janes
Date:
Subject: seg fault in contrib/bloom
Next
From: "David G. Johnston"
Date:
Subject: Re: Parameters don't work in FETCH NEXT clause?