Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.89) (envelope-from ) id 1hlTng-0001lx-08 for pgsql-hackers@arkaria.postgresql.org; Thu, 11 Jul 2019 07:47:32 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.89) (envelope-from ) id 1hlTne-0000ck-1X for pgsql-hackers@arkaria.postgresql.org; Thu, 11 Jul 2019 07:47:30 +0000 Received: from makus.postgresql.org ([2001:4800:3e1:1::229]) by malur.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.89) (envelope-from ) id 1hlTnd-0000V3-Jl for pgsql-hackers@lists.postgresql.org; Thu, 11 Jul 2019 07:47:29 +0000 Received: from xvm-110-146.dc2.ghst.net ([46.226.110.146] helo=fetter.org) by makus.postgresql.org with esmtp (Exim 4.89) (envelope-from ) id 1hlTna-0004jN-W4 for pgsql-hackers@postgresql.org; Thu, 11 Jul 2019 07:47:28 +0000 Received: by fetter.org (Postfix, from userid 1001) id 52018409CD; Thu, 11 Jul 2019 09:47:24 +0200 (CEST) Date: Thu, 11 Jul 2019 09:47:24 +0200 From: David Fetter To: Dmitry Dolgov <9erthalion6@gmail.com> Cc: Thomas Munro , Pavel Stehule , Alvaro Herrera , Thomas Munro , Oleksandr Shulgin , Artur Zakirov , Tom Lane , Robert Haas , Andres Freund , Michael Paquier , Oleg Bartunov , Peter Eisentraut , David Steele , PostgreSQL-development Subject: Re: [HACKERS] [PATCH] Generic type subscripting Message-ID: <20190711074723.GK24679@fetter.org> References: MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="mojUlQ0s9EVzWg2t" Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.9.4 (2018-02-28) List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Precedence: bulk --mojUlQ0s9EVzWg2t Content-Type: text/plain; charset=us-ascii Content-Disposition: inline On Tue, Jul 09, 2019 at 02:23:57PM +0200, Dmitry Dolgov wrote: > > On Mon, Jul 8, 2019 at 6:46 AM Thomas Munro wrote: > > > > On Fri, Jun 7, 2019 at 6:22 AM Dmitry Dolgov <9erthalion6@gmail.com> wrote: > > > > > >> Rebase after pg_indent. Besides, off the list there was a suggestion that this > > > > > >> could be useful to accept more than one data type as a key for subscripting. > > > > > >> E.g. for jsonb it probably makes sense to understand both a simple key name and > > > > > >> jsonpath: > > > > > > > > And one more rebase. > > > > > > Oh, looks like I was just confused and it wasn't necessary - for some reason > > > starting from v22 cfbot tries to apply v6 instead of the latest one. > > > > Hi Dmitry, > > > > Sorry about that. It looks like I broke the cfbot code that picks > > which thread to pull patches from when there are several registered in > > the CF app, the last time the HTML format changed. Now it's back to > > picking whichever thread has the most recent message on it. Such are > > the joys of web scraping (obviously we need better integration and > > that will happen, I just haven't had time yet). > > > > Anyway, I fixed that. But now you really do need to rebase :-) > > Thanks for fixing and for the reminder! Here is the new rebased version. It > contradicts a bit with 44982e7d09, because I'm actually using indexprSlice, but > I guess we can figure this out. > > And I must admit, it's a pure fun to maintain such a large patch set in sync > for already several years :) Looks great! The tutorial piece has bit-rotted slightly. Please find attached a patch atop yours that fixes it. Best, David. -- David Fetter http://fetter.org/ Phone: +1 415 235 3778 Remember to vote! Consider donating to Postgres: http://www.postgresql.org/about/donate --mojUlQ0s9EVzWg2t Content-Type: text/x-diff; charset=us-ascii Content-Disposition: attachment; filename="fix_subscripting_tutorial.patch" diff --git a/src/tutorial/subscripting.c b/src/tutorial/subscripting.c index c1ff66d299..9f64e3f2bd 100644 --- a/src/tutorial/subscripting.c +++ b/src/tutorial/subscripting.c @@ -170,7 +170,7 @@ custom_subscript_fetch(Datum containerSource, SubscriptingRefState *sbstate) if (sbstate->numupper != 1) ereport(ERROR, (errmsg("custom does not support nested subscripting"))); - index = DatumGetInt32(sbstate->upper[0]); + index = DatumGetInt32(sbstate->numupper); if (index == 1) return (Datum) container->first; @@ -190,7 +190,7 @@ custom_subscript_assign(Datum containerSource, SubscriptingRefState *sbstate) if (sbstate->numupper != 1) ereport(ERROR, (errmsg("custom does not support nested subscripting"))); - index = DatumGetInt32(sbstate->upper[0]); + index = DatumGetInt32(sbstate->numupper); if (index == 1) container->first = DatumGetInt32(sbstate->replacevalue); --mojUlQ0s9EVzWg2t--