From: | Manuel Rigger <rigger(dot)manuel(at)gmail(dot)com> |
---|---|
To: | Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us> |
Cc: | PostgreSQL mailing lists <pgsql-bugs(at)lists(dot)postgresql(dot)org> |
Subject: | Re: ALTER TABLE results in "ERROR: could not open relation with OID 43707388" |
Date: | 2019-11-03 11:55:11 |
Message-ID: | CA+u7OA7A1y9n_y7_7-e=125=-Qv+XcAqN_7gc=SRK=KsZXCOBw@mail.gmail.com |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-bugs |
Thanks a lot for the patch and for informing me about the fix!
Best,
Manuel
On Sat, Nov 2, 2019 at 5:04 PM Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us> wrote:
>
> I wrote:
> > Manuel Rigger <rigger(dot)manuel(at)gmail(dot)com> writes:
> >> CREATE TABLE t0(c0 INT);
> >> CREATE UNIQUE INDEX i0 ON t0(c0);
> >> ALTER TABLE t0 ADD PRIMARY KEY USING INDEX i0, ALTER c0 TYPE BIGINT;
> >> -- unexpected: ERROR: could not open relation with OID 43707388
>
> > The sequence of events here is that:
> > 1. transformIndexConstraint looks up the index "i0" and saves its OID
> > in the IndexStmt's indexOid field.
> > 2. ALTER c0 TYPE BIGINT executes first, because of ALTER TABLE's
> > pass design. It rebuilds the i0 index --- with a new OID.
> > 3. ATExecAddIndexConstraint tries to look up i0 using the old OID.
> > Kaboom.
>
> FYI, the patch I posted at
>
> https://www.postgresql.org/message-id/24573.1572647175%40sss.pgh.pa.us
>
> fixes this (as well as your other similar complaint). I forgot to
> add a regression test matching this case, but will do so later.
>
> regards, tom lane
From | Date | Subject | |
---|---|---|---|
Next Message | Tom Lane | 2019-11-03 15:42:13 | Re: Logical replication can be broken by domain constraint with NOT VALID option |
Previous Message | Andrey Lepikhov | 2019-11-03 07:57:00 | Logical replication can be broken by domain constraint with NOT VALID option |