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 1kLRvi-0001hn-Gl for pgsql-bugs@arkaria.postgresql.org; Thu, 24 Sep 2020 14:09:02 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.92) (envelope-from ) id 1kLRvg-0001HU-Js for pgsql-bugs@arkaria.postgresql.org; Thu, 24 Sep 2020 14:09:00 +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 1kLRvg-0001HM-Dx for pgsql-bugs@lists.postgresql.org; Thu, 24 Sep 2020 14:09:00 +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 1kLRvd-0006CG-0F for pgsql-bugs@lists.postgresql.org; Thu, 24 Sep 2020 14:08:59 +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 08OE8sAg1615414; Thu, 24 Sep 2020 10:08:54 -0400 From: Tom Lane To: michalalbrycht@gmail.com cc: pgsql-bugs@lists.postgresql.org Subject: Re: BUG #16634: Conflicting names of indexes for partitioned tables In-reply-to: <16634-7ca61b6fdb17fde8@postgresql.org> References: <16634-7ca61b6fdb17fde8@postgresql.org> Comments: In-reply-to PG Bug reporting form message dated "Thu, 24 Sep 2020 09:20:21 -0000" MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-ID: <1615412.1600956534.1@sss.pgh.pa.us> Date: Thu, 24 Sep 2020 10:08:54 -0400 Message-ID: <1615413.1600956534@sss.pgh.pa.us> List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Precedence: bulk PG Bug reporting form writes: > I think that whole problem is caused by auto-generated name for index for > partition tables. For parent table postgres is using name provided by user, > but for children tables it generates names automatically from name of the > table and fields that are used for index. But when we create index on > function it uses just function name. So for both indexes it generates name > like `child_1_lower_idx` despite the fact that one index is using > `lower(name)` and second one is using `lower(surname)`. > Why did it work with single thread? Apparently there is mechanism that tries > to solve conflicts as first index will get name: child_1_lower_idx and > second one will get child_1_lower_idx1 but for some reason this will not > work when indexes are created in parallel sessions. Well, it won't work reliably anyway; that's inherent to the problem. There's nothing here that's specific to partitioned tables, and I'm afraid the answer is "don't do that". It's not very hard to find other examples where parallel creation of objects can hit conflicts. regards, tom lane