From: Dmitry Dolgov <9erthalion6@gmail.com>
To: Alexander Korotkov <aekorotkov@gmail.com>
Cc: Pavel Stehule <pavel.stehule@gmail.com>
Cc: Justin Pryzby <pryzby@telsasoft.com>
Cc: Tom Lane <tgl@sss.pgh.pa.us>
Cc: David Steele <david@pgmasters.net>
Cc: Nikita Glukhov <n.gluhov@postgrespro.ru>
Cc: Alvaro Herrera <alvherre@2ndquadrant.com>
Cc: David Fetter <david@fetter.org>
Cc: Thomas Munro <thomas.munro@gmail.com>
Cc: Thomas Munro <thomas.munro@enterprisedb.com>
Cc: Oleksandr Shulgin <oleksandr.shulgin@zalando.de>
Cc: Robert Haas <robertmhaas@gmail.com>
Cc: Andres Freund <andres@anarazel.de>
Cc: Michael Paquier <michael.paquier@gmail.com>
Cc: Oleg Bartunov <obartunov@gmail.com>
Cc: Peter Eisentraut <peter.eisentraut@2ndquadrant.com>
Cc: PostgreSQL Hackers <pgsql-hackers@postgresql.org>
Subject: Re: [HACKERS] [PATCH] Generic type subscripting
Date: Mon, 30 Nov 2020 14:26:19 +0100
Message-ID: <20201130132619.zzgl272m5rcnhvzt@localhost> (raw)
In-Reply-To: <CAPpHfdtenYX+JKoDnuZQDJTc3Hx_2SK=vqYkpNUFfLL7j9c9QQ@mail.gmail.com>
References: <20200917135627.7koag6rnhshgjlai@localhost>
<CAFj8pRAQS3Z_ViOmMKCHWTu2uzajCuUUWwxq3z2nWpRWE1D3tg@mail.gmail.com>
<20200918110204.77yu4ioqlhhfhcya@localhost>
<CAFj8pRCUSjBAzdfe3meEk9OMY-ZaQRmTgsaJwGRDQ+jh=0x5gA@mail.gmail.com>
<20200920154652.etzmrphoe3hiod7t@localhost>
<CAFj8pRCAeJABdnU68orQ_SetFPiV7kvFgLAyU2ZF8d2n3RFXSA@mail.gmail.com>
<20200928093631.obnmgllx3ihhjvsd@localhost>
<CAPpHfdsP4xtDZfm2Ouat6vqf1U6gKMHiyW6gk6FPj35QDSq5kg@mail.gmail.com>
<20201130113454.ohb6oho4fvwtpz3t@localhost>
<CAPpHfdtenYX+JKoDnuZQDJTc3Hx_2SK=vqYkpNUFfLL7j9c9QQ@mail.gmail.com>
> On Mon, Nov 30, 2020 at 04:12:29PM +0300, Alexander Korotkov wrote:
>
> > > 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?
Sure, doesn't seem to be that much work.
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Reply to all the recipients from your mail client; the link fills in
the headers below: reply via email
Some clients, webmail especially, drop In-Reply-To and References from
a link, and the reply then starts a new thread: use the mbox below.
To: pgsql-hackers@postgresql.org
Cc: 9erthalion6@gmail.com, aekorotkov@gmail.com, pavel.stehule@gmail.com, pryzby@telsasoft.com, tgl@sss.pgh.pa.us, david@pgmasters.net, n.gluhov@postgrespro.ru, alvherre@2ndquadrant.com, david@fetter.org, thomas.munro@gmail.com, thomas.munro@enterprisedb.com, oleksandr.shulgin@zalando.de, robertmhaas@gmail.com, andres@anarazel.de, michael.paquier@gmail.com, obartunov@gmail.com, peter.eisentraut@2ndquadrant.com
Subject: Re: [HACKERS] [PATCH] Generic type subscripting
In-Reply-To: <20201130132619.zzgl272m5rcnhvzt@localhost>
References: <20200917135627.7koag6rnhshgjlai@localhost> <CAFj8pRAQS3Z_ViOmMKCHWTu2uzajCuUUWwxq3z2nWpRWE1D3tg@mail.gmail.com> <20200918110204.77yu4ioqlhhfhcya@localhost> <CAFj8pRCUSjBAzdfe3meEk9OMY-ZaQRmTgsaJwGRDQ+jh=0x5gA@mail.gmail.com> <20200920154652.etzmrphoe3hiod7t@localhost> <CAFj8pRCAeJABdnU68orQ_SetFPiV7kvFgLAyU2ZF8d2n3RFXSA@mail.gmail.com> <20200928093631.obnmgllx3ihhjvsd@localhost> <CAPpHfdsP4xtDZfm2Ouat6vqf1U6gKMHiyW6gk6FPj35QDSq5kg@mail.gmail.com> <20201130113454.ohb6oho4fvwtpz3t@localhost> <CAPpHfdtenYX+JKoDnuZQDJTc3Hx_2SK=vqYkpNUFfLL7j9c9QQ@mail.gmail.com> <20201130132619.zzgl272m5rcnhvzt@localhost>
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox