Re: BUG #17339: Assert failed on attempt to detach a sequence concurrently

From: Alexander Lakhin <exclusion(at)gmail(dot)com>
To: Kyotaro Horiguchi <horikyota(dot)ntt(at)gmail(dot)com>, michael(at)paquier(dot)xyz
Cc: peter(dot)eisentraut(at)enterprisedb(dot)com, pgsql-bugs(at)lists(dot)postgresql(dot)org
Subject: Re: BUG #17339: Assert failed on attempt to detach a sequence concurrently
Date: 2021-12-21 04:00:00
Message-ID: 91a6d779-126b-734c-5f73-e9282a3405a5@gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-bugs

Hello Michael and Kyotaro-san,
21.12.2021 06:03, Kyotaro Horiguchi wrote:
>> This would also fail when attempting to detach a foreign table, as
>> well, and these are legal relkinds in a partition tree. Once we do
>> that, we fall down into the same failure as for the non-concurrent
>> mode in RemoveInheritance(), telling that the relation is not a member
>> of the partition tree.
> I agree to the discussion above thus it seems to me right that we just
> remove the assertion. We never have a partition of un-attachable
> relkind so such kind of relations are surely rejected just after. The
> assertion on "== RELKIND_PARTITIONED_TABLE" is still valid since we
> don't reach there for the case of the traditional inheritance.
>
>
As detaching a foreign table is a valid scenario (not covered before),
maybe it's worth to exercise it as following:

--- a/contrib/postgres_fdw/sql/postgres_fdw.sql
+++ b/contrib/postgres_fdw/sql/postgres_fdw.sql
@@ -1490,6 +1490,8 @@ CREATE FOREIGN TABLE foreign_tbl (a int, b int)
 
 CREATE TABLE parent_tbl (a int, b int) PARTITION BY RANGE(a);
 ALTER TABLE parent_tbl ATTACH PARTITION foreign_tbl FOR VALUES FROM (0)
TO (100);
+ALTER TABLE parent_tbl DETACH PARTITION foreign_tbl CONCURRENTLY;
+ALTER TABLE parent_tbl ATTACH PARTITION foreign_tbl FOR VALUES FROM (0)
TO (100);
 
 CREATE VIEW rw_view AS SELECT * FROM parent_tbl
   WHERE a < b WITH CHECK OPTION;

Thanks!

Best regards,
Alexander

In response to

Responses

Browse pgsql-bugs by date

  From Date Subject
Next Message PG Bug reporting form 2021-12-21 10:32:40 BUG #17341: The comment of the source code is not correct
Previous Message Kyotaro Horiguchi 2021-12-21 03:03:22 Re: BUG #17339: Assert failed on attempt to detach a sequence concurrently