Re: REINDEX CONCURRENTLY unexpectedly fails

From: Andres Freund <andres(at)anarazel(dot)de>
To: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Cc: Manuel Rigger <rigger(dot)manuel(at)gmail(dot)com>, PostgreSQL mailing lists <pgsql-bugs(at)lists(dot)postgresql(dot)org>
Subject: Re: REINDEX CONCURRENTLY unexpectedly fails
Date: 2019-11-13 16:38:51
Message-ID: 20191113163851.e2enkdpvd3nrobst@alap3.anarazel.de
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-bugs

Hi,

On 2019-11-13 10:59:08 -0500, Tom Lane wrote:
> Andres Freund <andres(at)anarazel(dot)de> writes:
> > On 2019-11-13 15:29:53 +0100, Manuel Rigger wrote:
> >> On the latest trunk version, I get an error "index "t0_pkey_ccnew"
> >> already contains data" when using REINDEX CONCURRENTLY:
> >>
> >> CREATE TEMP TABLE t0(c1 INT PRIMARY KEY) ON COMMIT DELETE ROWS;
> >> REINDEX TABLE CONCURRENTLY t0; -- unexpected: ERROR: index
> >> "t0_pkey_ccnew" already contains data
>
> > It think we really ought to just refuse CIC (and thereby REINDEX
> > CONCURRENTLY) for ON COMMIT DELETE/DROP temp tables. Given that CIC
> > internally uses transactions, it makes no sense to use CIC on such a
> > table.
>
> It's not real clear why there would be any point in (RE)INDEX
> CONCURRENTLY on a temp table anyway, since no other session could
> be using it.

Right.

I guess it's not necessarily always clear in all contexts that one is
dealing with a temp table, rather than a normal table.

> +1 for just erroring out, rather than working hard to support such a
> case.

I wonder if we instead ought to just ignore the CONCURRENTLY when
targetting a temp table? That'd be a correct optimization for temp
tables, and would fix the issue at hand...

Greetings,

Andres Freund

In response to

Responses

Browse pgsql-bugs by date

  From Date Subject
Next Message Cagri Biroglu 2019-11-13 16:39:59 repomd.xml update
Previous Message Manuel Rigger 2019-11-13 16:01:56 Unexpected "cache lookup failed for collation 0" failure