Re: [HACKERS] [PATCH] Generic type subscripting

Alexander Korotkov <aekorotkov@gmail.com>

From: Alexander Korotkov <aekorotkov@gmail.com>
To: Dmitry Dolgov <9erthalion6@gmail.com>
Cc: Pavel Stehule <pavel.stehule@gmail.com>, Justin Pryzby <pryzby@telsasoft.com>, Tom Lane <tgl@sss.pgh.pa.us>, David Steele <david@pgmasters.net>, Nikita Glukhov <n.gluhov@postgrespro.ru>, Alvaro Herrera <alvherre@2ndquadrant.com>, David Fetter <david@fetter.org>, Thomas Munro <thomas.munro@gmail.com>, Thomas Munro <thomas.munro@enterprisedb.com>, Oleksandr Shulgin <oleksandr.shulgin@zalando.de>, Robert Haas <robertmhaas@gmail.com>, Andres Freund <andres@anarazel.de>, Michael Paquier <michael.paquier@gmail.com>, Oleg Bartunov <obartunov@gmail.com>, Peter Eisentraut <peter.eisentraut@2ndquadrant.com>, PostgreSQL Hackers <pgsql-hackers@postgresql.org>
Date: 2020-11-30T13:12:29Z
Lists: pgsql-hackers
On Mon, Nov 30, 2020 at 2:33 PM Dmitry Dolgov <9erthalion6@gmail.com> wrote:
> > On Fri, Nov 27, 2020 at 12:13:48PM +0300, Alexander Korotkov wrote:
> > I've started to review this patch.
>
> Thanks!
>
> > My first question is whether we're
> > able to handle different subscript types differently.  For instance,
> > one day we could handle jsonpath subscripts for jsonb.  And for sure,
> > jsonpath subscripts are expected to be handled differently from text
> > subscripts.  I see we can distinguish types during in prepare and
> > validate functions.  But it seems there is no type information in
> > fetch and assign functions.  Should we add something like this to the
> > SubscriptingRefState for future usage?
> >
> > Datum uppertypeoid[MAX_SUBSCRIPT_DEPTH];
> > Datum lowertypeoid[MAX_SUBSCRIPT_DEPTH];
>
> Yes, makes sense. My original idea was that it could be done within the
> jsonpath support patch itself, but at the same time providing these
> fields into SubscriptingRefState will help other potential extensions.
>
> Having said that, maybe it would be even better to introduce a field
> with an opaque structure for both SubscriptingRefState and
> SubscriptingRef, where every implementation of custom subscripting can
> store any necessary information? In case of jsonpath it could keep type
> information acquired in prepare function, which would be then passed via
> SubscriptingRefState down to the fetch/assign.

The idea of an opaque field in SubscriptingRef structure is more
attractive to me.  Could you please implement it?

------
Regards,
Alexander Korotkov



Commits

  1. Throw error when assigning jsonb scalar instead of a composite object

  2. Filling array gaps during jsonb subscripting

  3. Implementation of subscripting for jsonb

  4. Allow ALTER TYPE to update an existing type's typsubscript value.

  5. Allow subscripting of hstore values.

  6. Support subscripting of arbitrary types, not only arrays.

  7. jit: Reference function pointer types via llvmjit_types.c.

  8. Teach contain_leaked_vars that assignment SubscriptingRefs are leaky.

  9. jit: Correct parameter type for generated expression evaluation functions.

  10. Renaming for new subscripting mechanism

  11. Fix assertion failure for SSL connections.

  12. Teach eval_const_expressions() to handle some more cases.