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 1hp2Nf-0003cT-C6 for pgsql-bugs@arkaria.postgresql.org; Sun, 21 Jul 2019 03:19:23 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.89) (envelope-from ) id 1hp2Nc-0003cy-76 for pgsql-bugs@arkaria.postgresql.org; Sun, 21 Jul 2019 03:19:20 +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 1hp2Nb-0003cI-M0 for pgsql-bugs@lists.postgresql.org; Sun, 21 Jul 2019 03:19:19 +0000 Received: from sss.pgh.pa.us ([66.207.139.130]) by makus.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.92) (envelope-from ) id 1hp2NY-0006pw-RX for pgsql-bugs@lists.postgresql.org; Sun, 21 Jul 2019 03:19:18 +0000 Received: from sss1.sss.pgh.pa.us (localhost [127.0.0.1]) by sss.pgh.pa.us (8.14.4/8.14.4) with ESMTP id x6L3JCTR007780; Sat, 20 Jul 2019 23:19:12 -0400 From: Tom Lane To: Manuel Rigger cc: PostgreSQL mailing lists Subject: Re: REINDEX CONCURRENTLY causes ALTER TABLE to fail In-reply-to: References: Comments: In-reply-to Manuel Rigger message dated "Wed, 17 Jul 2019 14:53:54 +0200" MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-ID: <7778.1563679152.1@sss.pgh.pa.us> Date: Sat, 20 Jul 2019 23:19:12 -0400 Message-ID: <7779.1563679152@sss.pgh.pa.us> List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Precedence: bulk Manuel Rigger writes: > Consider the following statement sequence: > CREATE TABLE t0(c0 INTEGER , c1 BOOLEAN); > INSERT INTO t0(c0, c1) VALUES(1369652450, FALSE), (414515746, TRUE), > (897778963, FALSE); > CREATE UNIQUE INDEX i0 ON t0((1 / t0.c0)) WHERE ('-H') >= > (t0.c1::TEXT) COLLATE "C"; > REINDEX TABLE CONCURRENTLY t0; > ALTER TABLE t0 ALTER c1 TYPE TEXT; -- could not create unique index > "i0" DETAIL: Key ((1 / c0))=(0) is duplicated. > The REINDEX TABLE CONCURRENTLY causes the ALTER TABLE to fail, which > is unexpected. BTW, a note for anybody trying to follow along at home --- this example does not reproduce if the database's default collation is "C". regards, tom lane