Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1kjhRM-0003uG-7d for pgsql-hackers@arkaria.postgresql.org; Mon, 30 Nov 2020 11:33:56 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.92) (envelope-from ) id 1kjhRL-0006Ac-2T for pgsql-hackers@arkaria.postgresql.org; Mon, 30 Nov 2020 11:33:55 +0000 Received: from makus.postgresql.org ([2001:4800:3e1:1::229]) by malur.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from <9erthalion6@gmail.com>) id 1kjhRK-0006AV-Po for pgsql-hackers@lists.postgresql.org; Mon, 30 Nov 2020 11:33:54 +0000 Received: from mail-wr1-x441.google.com ([2a00:1450:4864:20::441]) by makus.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.92) (envelope-from <9erthalion6@gmail.com>) id 1kjhRI-0001xj-Dl for pgsql-hackers@postgresql.org; Mon, 30 Nov 2020 11:33:53 +0000 Received: by mail-wr1-x441.google.com with SMTP id g14so15665775wrm.13 for ; Mon, 30 Nov 2020 03:33:52 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=date:from:to:cc:subject:message-id:references:mime-version :content-disposition:in-reply-to; bh=uDLgm7FNWH0IreGlOUrBiYoo6UC5QQaFhQ1VXlqnNds=; b=GKL6I9gIvXVzw9BJaSnNyjdmJwfVZeW/GHdqP1+xc+0vSQ9miAxEqRP/pOpTFcjFAP 4NW9Hr9fAAukc5ULydcQkjUy3SNAbJ15PIf2i57ZCy2OnQAN9en8m41u2yibXEgKTj7G p3by+rZay+ZiA6zHav72V05RJ3PmgrLgBKZgtVZG9FgkygNpiheDvdNDLBICshnPQp94 8qFMPEyN/0n9yG7TRLWBuwOECcnl+0UaXeYhRlPPdS8qlHFgxvhzshBi7t0fIKj9SuXK rTSdO3AchZBm7fKy/ADTtZakLBd6s0GagnrwxUHwC4MI3JnFJ1bX7Rl3WcdFCkodWtFr i+3g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:in-reply-to; bh=uDLgm7FNWH0IreGlOUrBiYoo6UC5QQaFhQ1VXlqnNds=; b=sP7errw9IRLQrAbk0UqAYmo6egTog61DiJwce38O18TeguztZMj6v2/NlSE8aNnzb+ h4Bl2GboE5nLV2w2rjmHGAgVudCd718m4loLNQYDXRe6IMIbbXvzUpiwlJbvLvUv7Ppg AayST5R1ivl5ZkvqrD+zdx5dntnvRtpQQ/rB2p07dpe6+5UemIf2J02i08ZfUjgVV/Zl +72XzofFqu1l49d8gd4xF39eZ9msckwqd4gzy85PMb6Ks5YkPM+64q7RBNMVvOSSAXZP sOoX3gKIquvh8FxiZemJ+Wl/HzXNsiKY3jzvbAbbJIgdBISgGieDM+5NXQxqfMxaOA57 Y3bg== X-Gm-Message-State: AOAM533F+N3oK51kq1fiDMVeDn3IsqSq/27vdFrB2Dy7enfjBrbtjnkk 36+w4S2BcfLlzG0YJW9CUsA= X-Google-Smtp-Source: ABdhPJx2HGdbcSkeQan/dhMFphCHUmxjqTyaH7c1ZFGNiNg/ZYwLrKcql0e5npL0vfOXn7Fy5c7+Gg== X-Received: by 2002:a05:6000:89:: with SMTP id m9mr28219514wrx.412.1606736029899; Mon, 30 Nov 2020 03:33:49 -0800 (PST) Received: from localhost (dslb-188-102-101-219.188.102.pools.vodafone-ip.de. [188.102.101.219]) by smtp.gmail.com with ESMTPSA id u66sm4023576wmg.30.2020.11.30.03.33.47 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 30 Nov 2020 03:33:48 -0800 (PST) Date: Mon, 30 Nov 2020 12:34:54 +0100 From: Dmitry Dolgov <9erthalion6@gmail.com> To: Alexander Korotkov Cc: Pavel Stehule , Justin Pryzby , Tom Lane , David Steele , Nikita Glukhov , Alvaro Herrera , David Fetter , Thomas Munro , Thomas Munro , Oleksandr Shulgin , Robert Haas , Andres Freund , Michael Paquier , Oleg Bartunov , Peter Eisentraut , PostgreSQL Hackers Subject: Re: [HACKERS] [PATCH] Generic type subscripting Message-ID: <20201130113454.ohb6oho4fvwtpz3t@localhost> References: <20200917105849.vgqhutrooatdxwzq@localhost> <20200917135627.7koag6rnhshgjlai@localhost> <20200918110204.77yu4ioqlhhfhcya@localhost> <20200920154652.etzmrphoe3hiod7t@localhost> <20200928093631.obnmgllx3ihhjvsd@localhost> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Precedence: bulk > On Fri, Nov 27, 2020 at 12:13:48PM +0300, Alexander Korotkov wrote: > > Hi! > > 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.