Re: REINDEX CONCURRENTLY causes ALTER TABLE to fail

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: Manuel Rigger <rigger(dot)manuel(at)gmail(dot)com>
Cc: PostgreSQL mailing lists <pgsql-bugs(at)lists(dot)postgresql(dot)org>
Subject: Re: REINDEX CONCURRENTLY causes ALTER TABLE to fail
Date: 2019-07-21 03:19:12
Message-ID: 7779.1563679152@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-bugs

Manuel Rigger <rigger(dot)manuel(at)gmail(dot)com> 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

In response to

Browse pgsql-bugs by date

  From Date Subject
Next Message Tom Lane 2019-07-21 03:27:17 Re: User mapping: view over a foreign table
Previous Message PG Bug reporting form 2019-07-20 23:56:09 BUG #15920: ERROR: deadlock detected