Re: cannot CREATE INDEX because it has pending trigger events

From: Luca Ferrari <fluca1978(at)gmail(dot)com>
To: Simon Kissane <skissane(at)medallia(dot)com>
Cc: pgsql-general <pgsql-general(at)postgresql(dot)org>
Subject: Re: cannot CREATE INDEX because it has pending trigger events
Date: 2019-08-27 07:55:03
Message-ID: CAKoxK+7v6HLTbWfzzFURvbadmwncUTVQU_3ghZqTLt16e2aVgQ@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

On Tue, Aug 27, 2019 at 9:33 AM Simon Kissane <skissane(at)medallia(dot)com> wrote:
> If I swap the order of the CREATE UNIQUE INDEX and the INSERT, so the index gets created first, the error doesn't happen.

It also works removing the INITIALLY DEFERRED from the foreign key,
since it seems you are creating tuples in the right order (at least in
this simplified model).
The index is not created because the foreign key is validated at the
transaction commit.

>
> I don't understand why having a deferred FK to check should stop me from creating a unique index. I also don't understand why this worked in 9.6 but not anymore.

I've tested against 12beta2, it would be nice to understand what
changed in (I suspect) SET TRANSACTION.

Luca

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Laurenz Albe 2019-08-27 07:59:20 Re: cannot CREATE INDEX because it has pending trigger events
Previous Message Arnaud L. 2019-08-27 07:54:01 Re: psql \copy hanging