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 1kjjBD-0007Kx-VU for pgsql-hackers@arkaria.postgresql.org; Mon, 30 Nov 2020 13:25:24 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.92) (envelope-from ) id 1kjjBC-0005W5-Sa for pgsql-hackers@arkaria.postgresql.org; Mon, 30 Nov 2020 13:25:22 +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 1kjjBC-0005Vw-Ik for pgsql-hackers@lists.postgresql.org; Mon, 30 Nov 2020 13:25:22 +0000 Received: from mail-wr1-x442.google.com ([2a00:1450:4864:20::442]) by makus.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.92) (envelope-from <9erthalion6@gmail.com>) id 1kjjB6-0002vk-AQ for pgsql-hackers@postgresql.org; Mon, 30 Nov 2020 13:25:21 +0000 Received: by mail-wr1-x442.google.com with SMTP id t4so16154502wrr.12 for ; Mon, 30 Nov 2020 05:25:16 -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=ScbDKDogILMF40WQ+LvAY910vUTMGa7tZze5EMYAzXk=; b=HUUiFGam+fR4xFS+lCr7JQG1kzDw/DRKtq5zNSj/WUQHPg2ALlioDa8JrjL/VqJ8Om efIOkw4jElaOlpEMLSpveUikCqqawBIiZXt3rEUmykoqbYlfafviqt7w6pzeDkWKFy5h pFY8PAQ0FrzHAtudSStPUYdJ365WkjbMraljemBg9FEVDNQtbLg1voc6iDp0UHpPxDA4 +FoyDT87BGfIyefwfHkcl8ceYlEb4cjXWLclof/IXreS/t7RyNO2sxet9fuK7WRMYMWg vcUtnrXfbzsv81OYYL1QQkEzm9I5+4bqYbO39LcfjCYerY4OjRv++O5ygIThOFrz+bcr egJQ== 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=ScbDKDogILMF40WQ+LvAY910vUTMGa7tZze5EMYAzXk=; b=Zl/FmJ++g9IbZzuirCExdaMWp/AMS5doVimevdFNbnZkAFDcOIxcldwG/6vykEvIBY +XX4jdkrSmIma2bITTCaz7SxleLVDHHhAIytsmPEnZr/8zt8wXLAhwXyaMG2mutclEqg Dvx6/ik8btshcMdVrGy68AB9hkWbiKtD/oIXkTM0JNtkQRuBUz/iEviwoIybs/p22+ju 4m2luSB7hlrD1ICpNabgqK6m2jMLxjClEYm0VyajdaBTXQ0am0o9I//bbeV17FGnjBG7 13WJP/bUFlkkCtvS9vZbnV7TJp7lk3cXbDBeZ8zQv7q7rMiwheB0hrBZKI9vh94iZnsZ ZWTQ== X-Gm-Message-State: AOAM531XMJi69jVs7lxG075srFTiMjUjeJun3oYJthGnxm1nQ58kZgoX t3RU/HXwuO++iT0v6576EfU= X-Google-Smtp-Source: ABdhPJwLdmhfpotZmJMi5wEb8IbP/GGzgmUyPL3hGwm71DBJroIZtI/IXzaffoh/WbaPSwXZuTMqhA== X-Received: by 2002:a5d:4a0a:: with SMTP id m10mr29152791wrq.16.1606742714621; Mon, 30 Nov 2020 05:25:14 -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 c9sm26175280wrp.73.2020.11.30.05.25.12 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 30 Nov 2020 05:25:13 -0800 (PST) Date: Mon, 30 Nov 2020 14:26:19 +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: <20201130132619.zzgl272m5rcnhvzt@localhost> References: <20200917135627.7koag6rnhshgjlai@localhost> <20200918110204.77yu4ioqlhhfhcya@localhost> <20200920154652.etzmrphoe3hiod7t@localhost> <20200928093631.obnmgllx3ihhjvsd@localhost> <20201130113454.ohb6oho4fvwtpz3t@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 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.