Re: BUG #18541: Reattaching a partition referenced by a foreign key fails with an error

From: Tender Wang <tndrwang(at)gmail(dot)com>
To: exclusion(at)gmail(dot)com, pgsql-bugs(at)lists(dot)postgresql(dot)org
Subject: Re: BUG #18541: Reattaching a partition referenced by a foreign key fails with an error
Date: 2024-07-15 13:18:34
Message-ID: CAHewXNkcJo3d9Qj00FGof9dpHg8A4W9x-XJx9EsfrS8w7M395Q@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-bugs

PG Bug reporting form <noreply(at)postgresql(dot)org> 于2024年7月15日周一 21:02写道:

> The following bug has been logged on the website:
>
> Bug reference: 18541
> Logged by: Alexander Lakhin
> Email address: exclusion(at)gmail(dot)com
> PostgreSQL version: 17beta2
> Operating system: Ubuntu 22.04
> Description:
>
> The following script:
> CREATE TABLE t1 (a int, PRIMARY KEY (a));
> CREATE TABLE t (a int, PRIMARY KEY (a), FOREIGN KEY (a) REFERENCES t1)
> PARTITION BY LIST (a);
> ALTER TABLE t ATTACH PARTITION t1 FOR VALUES IN (1);
> ALTER TABLE t DETACH PARTITION t1;
> ALTER TABLE t ATTACH PARTITION t1 FOR VALUES IN (1);
>
> ends up with the error complaining about check triggers:
> ERROR: XX000: could not find ON INSERT check triggers of foreign key
> constraint 16400
> LOCATION: GetForeignKeyCheckTriggers, tablecmds.c:11260
>
> Reproduced on REL_15_STABLE (starting from f4566345c) .. master.
>
> Hi Alexander,
I saw the same error in [1]. I guess it is same issue.
I send a patch in [1], but it may need a more work.

[1] https://www.postgresql.org/message-id/20230705233028.2f554f73%40karst

--
Tender Wang

In response to

Browse pgsql-bugs by date

  From Date Subject
Next Message Tom Lane 2024-07-15 13:55:28 Re: BUG #17889: Invalid cursor direction for a foreign scan that reached the fetch_size (MOVE BACKWARD ALL IN cX)
Previous Message Aleksander Alekseev 2024-07-15 12:17:53 Re: BUG #18536: Using WITH inside WITH RECURSIVE triggers a "shouldn't happen" error