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 1lyIbS-000302-HQ for pgsql-bugs@arkaria.postgresql.org; Tue, 29 Jun 2021 18:36:58 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.92) (envelope-from ) id 1lyIbR-00016p-DP for pgsql-bugs@arkaria.postgresql.org; Tue, 29 Jun 2021 18:36:57 +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 ) id 1lyIbR-00016h-6r for pgsql-bugs@lists.postgresql.org; Tue, 29 Jun 2021 18:36:57 +0000 Received: from sss.pgh.pa.us ([66.207.139.130]) by makus.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1lyIbP-0008OK-9T for pgsql-bugs@lists.postgresql.org; Tue, 29 Jun 2021 18:36:56 +0000 Received: from sss1.sss.pgh.pa.us (localhost [127.0.0.1]) by sss.pgh.pa.us (8.15.2/8.15.2) with ESMTP id 15TIaq3G485565; Tue, 29 Jun 2021 14:36:52 -0400 From: Tom Lane To: Amit Langote cc: Peter Eisentraut , exclusion@gmail.com, PostgreSQL mailing lists Subject: Re: BUG #17076: Server crashes on composing an error message about invalid modulus for a new table partition In-reply-to: References: <17076-89a16ae835d329b9@postgresql.org> <342122.1624914489@sss.pgh.pa.us> <346711.1624919432@sss.pgh.pa.us> Comments: In-reply-to Amit Langote message dated "Tue, 29 Jun 2021 16:11:51 +0900" MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-ID: <485563.1624991812.1@sss.pgh.pa.us> Date: Tue, 29 Jun 2021 14:36:52 -0400 Message-ID: <485564.1624991812@sss.pgh.pa.us> List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk Amit Langote writes: > On Tue, Jun 29, 2021 at 7:30 AM Tom Lane wrote: >>> I think the patch has got more problems than that too, as it's far >>> from clear why the next remainder would have anything to do with the >>> next larger modulus. > Yes. Though, I think the problem is that the code uses > boundinfo->indexes[] as an index into partdesc->oids[] array > to get the existing partition to show in the error message. The > correct thing here would be to use directly. That is because > the hash partition bounds as laid out in boudinfo->datums[] correspond > one-to-one with the partition OIDs laid out in partdesc->oids[]. Got it. Pushed your fix, along with some twiddling of the nearby comments which seemed a bit vague. regards, tom lane