pg.ddx.io  pgsql-bugs@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Michael Paquier <michael@paquier.xyz>
To: Peter Eisentraut <peter.eisentraut@enterprisedb.com>
Cc: exclusion@gmail.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 09:30:42 +0900
Message-ID: <YcEgMqPy3VkWmgiJ@paquier.xyz> (raw)
In-Reply-To: <c19d2596-c525-1405-fe14-73bed9af6bde@enterprisedb.com>
References: <17339-a9e09aaf38a3457a@postgresql.org>
	<YcB5K6/Mrh9X82lG@paquier.xyz>
	<c19d2596-c525-1405-fe14-73bed9af6bde@enterprisedb.com>

On Mon, Dec 20, 2021 at 09:57:47PM +0100, Peter Eisentraut wrote:
> On 20.12.21 13:38, Michael Paquier wrote:
>> Attached is a patch, with some regression tests.
> 
> Is it possible for child tables in partitioned tables to have different
> ownerships?  Then this change would introduce a new failure mode.

Hmm.  Yes, you are right here.  It is possible to change the ownership
of a partition after it gets attached, so this could cause a
regression.  I recalled that this was not possible, so my memories
were wrong.

At the end, perhaps we should just remove the assertion that assumes
which relkind is right for the partition, as of:
--- a/src/backend/commands/tablecmds.c
+++ b/src/backend/commands/tablecmds.c
@@ -15013,8 +15013,6 @@ MarkInheritDetached(Relation child_rel,
Relation parent_rel)
    HeapTuple   inheritsTuple;
        bool        found = false;

-   Assert(child_rel->rd_rel->relkind == RELKIND_RELATION ||
-          child_rel->rd_rel->relkind == RELKIND_PARTITIONED_TABLE);
    Assert(parent_rel->rd_rel->relkind == RELKIND_PARTITIONED_TABLE);

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.
--
Michael

Attachments:

  [application/pgp-signature] signature.asc (832B, ../YcEgMqPy3VkWmgiJ@paquier.xyz/2-signature.asc)
  download

view thread (7+ messages)  latest in thread

Message-ID: <YcEgMqPy3VkWmgiJ@paquier.xyz>
Permalink:  ../YcEgMqPy3VkWmgiJ@paquier.xyz/
Also on:    postgresql.org/message-id/YcEgMqPy3VkWmgiJ@paquier.xyz

 · 

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: michael@paquier.xyz, peter.eisentraut@enterprisedb.com, exclusion@gmail.com, pgsql-bugs@lists.postgresql.org
  Subject: Re: BUG #17339: Assert failed on attempt to detach a sequence concurrently
  In-Reply-To: <YcEgMqPy3VkWmgiJ@paquier.xyz>

* 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