Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1qRGAQ-00158Q-C7 for pgsql-bugs@arkaria.postgresql.org; Wed, 02 Aug 2023 18:01:50 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.94.2) (envelope-from ) id 1qRGAN-006xDd-Mo for pgsql-bugs@arkaria.postgresql.org; Wed, 02 Aug 2023 18:01:48 +0000 Received: from makus.postgresql.org ([2001:4800:3e1:1::229]) by malur.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1qRGAN-006xDV-9Z for pgsql-bugs@lists.postgresql.org; Wed, 02 Aug 2023 18:01:47 +0000 Received: from sss.pgh.pa.us ([66.207.139.130]) by makus.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1qRGAJ-000ArC-Ee for pgsql-bugs@lists.postgresql.org; Wed, 02 Aug 2023 18:01:46 +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 372I1ecK3303211; Wed, 2 Aug 2023 14:01:40 -0400 From: Tom Lane To: Michael Paquier cc: Alexander Lakhin , pgsql-bugs@lists.postgresql.org Subject: Re: BUG #17997: Assert failed in validatePartitionedIndex() when attaching partition index to child of valid index In-reply-to: References: <17997-a044c27aef95daf8@postgresql.org> <509915.1687704058@sss.pgh.pa.us> <14987634-43c0-0cb3-e075-94d423607e08@gmail.com> <3eaa2c33-2ed1-2996-c6b6-0e7552a64cae@gmail.com> <611182a0-172e-cb80-965d-d6c69a1bde62@gmail.com> <9390b442-5c09-897f-a58c-b73bef7dd88c@gmail.com> Comments: In-reply-to Michael Paquier message dated "Fri, 30 Jun 2023 14:59:19 +0900" MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-ID: <3303209.1690999300.1@sss.pgh.pa.us> Date: Wed, 02 Aug 2023 14:01:40 -0400 Message-ID: <3303210.1690999300@sss.pgh.pa.us> List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk Michael Paquier writes: > On Fri, Jun 30, 2023 at 07:00:00AM +0300, Alexander Lakhin wrote: >> Yeah, in regard to that, your patch looks good to me. >> Thank you! > Cool, I have fixed this issue, then. The buildfarm looks OK with it. While going through the commit log to prepare release notes, I was struck by the fact that this commit (fc55c7ff8 et al) takes the approach of ignoring invalid child indexes during ATTACH PARTITION: I have studied a few options here (like the possibility to switch indisvalid to false for the parent), but came down to the conclusion that we'd better rely on a simple rule: invalid indexes had better never be chosen, so as the partition attached uses and creates indexes that the parent expects. However, your later fix for handling invalid child indexes during CREATE PARTITIONED INDEX (cfc43aeb3 et al) does the opposite: This patch makes sure that indisvalid is set to false on a partitioned index if at least one of its partition is invalid. The flag is set to true if *all* its partitions are valid. This seems inconsistent: why do we behave one way during CREATE and another during ATTACH? Do we even need fc55c7ff8's logic change anymore? That is, is it possible that the fixes added by cfc43aeb3 would be enough to resolve the problem (though with a different outcome that the partitioned index remains invalid after ATTACH PARTITION)? Perhaps the week before minor releases is not the time to be fooling around with this, but it seems like an odd set of choices. regards, tom lane