Re: [HACKERS] [PATCH] Generic type subscripting

From: Alexander Korotkov <aekorotkov(at)gmail(dot)com>
To: Dmitry Dolgov <9erthalion6(at)gmail(dot)com>
Cc: Pavel Stehule <pavel(dot)stehule(at)gmail(dot)com>, Justin Pryzby <pryzby(at)telsasoft(dot)com>, Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>, David Steele <david(at)pgmasters(dot)net>, Nikita Glukhov <n(dot)gluhov(at)postgrespro(dot)ru>, Alvaro Herrera <alvherre(at)2ndquadrant(dot)com>, David Fetter <david(at)fetter(dot)org>, Thomas Munro <thomas(dot)munro(at)gmail(dot)com>, Thomas Munro <thomas(dot)munro(at)enterprisedb(dot)com>, Oleksandr Shulgin <oleksandr(dot)shulgin(at)zalando(dot)de>, Robert Haas <robertmhaas(at)gmail(dot)com>, Andres Freund <andres(at)anarazel(dot)de>, Michael Paquier <michael(dot)paquier(at)gmail(dot)com>, Oleg Bartunov <obartunov(at)gmail(dot)com>, Peter Eisentraut <peter(dot)eisentraut(at)2ndquadrant(dot)com>, PostgreSQL Hackers <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: [HACKERS] [PATCH] Generic type subscripting
Date: 2020-11-30 13:12:29
Message-ID: CAPpHfdtenYX+JKoDnuZQDJTc3Hx_2SK=vqYkpNUFfLL7j9c9QQ@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On Mon, Nov 30, 2020 at 2:33 PM Dmitry Dolgov <9erthalion6(at)gmail(dot)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

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Michael Paquier 2020-11-30 13:13:02 Re: scram-sha-256 broken with FIPS and OpenSSL 1.0.2
Previous Message Ashutosh Bapat 2020-11-30 13:06:42 Re: Printing LSN made easy