Jsonb array-style subscripting, generic version

From: Dmitry Dolgov <9erthalion6(at)gmail(dot)com>
To: PostgreSQL-development <pgsql-hackers(at)postgresql(dot)org>
Subject: Jsonb array-style subscripting, generic version
Date: 2016-05-17 17:44:05
Message-ID: CA+q6zcVzfhNXnMZATgd7UOFPP2By_B_ciMJw8ETvezSnn5bZKg@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Hi

With regard to previous conversations:

http://www.postgresql.org/message-id/flat/CA+q6zcV8qvGcDXurwwgUbwACV86Th7G80pnubg42e-p9gsSf=g(at)mail(dot)gmail(dot)com#CA+q6zcV8qvGcDXurwwgUbwACV86Th7G80pnubg42e-p9gsSf=g@mail.gmail.com

http://www.postgresql.org/message-id/flat/CA+q6zcX3mdxGCgdThzuySwH-ApyHHM-G4oB1R0fn0j2hZqqkLQ(at)mail(dot)gmail(dot)com#CA+q6zcX3mdxGCgdThzuySwH-ApyHHM-G4oB1R0fn0j2hZqqkLQ@mail.gmail.com

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)?

Browse pgsql-hackers by date

  From Date Subject
Next Message David G. Johnston 2016-05-17 17:56:35 Re: Parameters don't work in FETCH NEXT clause?
Previous Message Jeff Janes 2016-05-17 17:25:44 seg fault in contrib/bloom