pg.ddx.io  pgsql-bugs@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Alexander Lakhin <exclusion@gmail.com>
To: Kyotaro Horiguchi <horikyota.ntt@gmail.com>
To: michael@paquier.xyz
Cc: peter.eisentraut@enterprisedb.com
Cc: pgsql-bugs@lists.postgresql.org
Subject: Re: BUG #17339: Assert failed on attempt to detach a sequence concurrently
Date: Tue, 21 Dec 2021 07:00:00 +0300
Message-ID: <91a6d779-126b-734c-5f73-e9282a3405a5@gmail.com> (raw)
In-Reply-To: <20211221.120322.916207154734438884.horikyota.ntt@gmail.com>
References: <YcB5K6/Mrh9X82lG@paquier.xyz>
	<c19d2596-c525-1405-fe14-73bed9af6bde@enterprisedb.com>
	<YcEgMqPy3VkWmgiJ@paquier.xyz>
	<20211221.120322.916207154734438884.horikyota.ntt@gmail.com>

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





view thread (7+ messages)  latest in thread

Message-ID: <91a6d779-126b-734c-5f73-e9282a3405a5@gmail.com>
Permalink:  ../91a6d779-126b-734c-5f73-e9282a3405a5@gmail.com/
Also on:    postgresql.org/message-id/91a6d779-126b-734c-5f73-e9282a3405a5@gmail.com

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients using the --to and --cc options:
  reply via email

  To: pgsql-bugs@postgresql.org
  Cc: exclusion@gmail.com, horikyota.ntt@gmail.com, michael@paquier.xyz, peter.eisentraut@enterprisedb.com, pgsql-bugs@lists.postgresql.org
  Subject: Re: BUG #17339: Assert failed on attempt to detach a sequence concurrently
  In-Reply-To: <91a6d779-126b-734c-5f73-e9282a3405a5@gmail.com>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox