pg.ddx.io  pgsql-committers@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Michael Paquier <michael@paquier.xyz>
To: pgsql-committers@lists.postgresql.org
Subject: pgsql: Remove assertion for ALTER TABLE .. DETACH PARTITION CONCURRENTL
Date: Wed, 22 Dec 2021 06:38:29 +0000
Message-ID: <E1mzvGf-00048j-V0@gemulon.postgresql.org> (raw)

Remove assertion for ALTER TABLE .. DETACH PARTITION CONCURRENTLY

One code path related to this flavor of ALTER TABLE was checking that
the relation to detach has to be a normal table or a partitioned table,
which would fail if using the command with a different relation kind.

Views, sequences and materialized views cannot be part of a partition
tree, so these would cause the command to fail anyway, but the assertion
was triggered.  Foreign tables can be part of a partition tree, and
again the assertion would have failed.  The simplest solution is just to
remove this assertion, so as we get the same failure as the
non-concurrent code path.

While on it, add a regression test in postgres_fdw for the concurrent
partition detach of a foreign table, as per a suggestion from Alexander
Lakhin.

Issue introduced in 71f4c8c.

Reported-by: Alexander Lakhin
Author: Michael Paquier, Alexander Lakhin
Reviewed-by: Peter Eisentraut, Kyotaro Horiguchi
Discussion: https://postgr.es/m/17339-a9e09aaf38a3457a@postgresql.org
Backpatch-through: 14

Branch
------
REL_14_STABLE

Details
-------
https://git.postgresql.org/pg/commitdiff/8a22a40b2cfd1ea3218663153e5c6d7ebc68d2bf

Modified Files
--------------
contrib/postgres_fdw/expected/postgres_fdw.out | 3 +++
contrib/postgres_fdw/sql/postgres_fdw.sql      | 3 +++
src/backend/commands/tablecmds.c               | 2 --
3 files changed, 6 insertions(+), 2 deletions(-)



view thread (2+ messages)  latest in thread

Message-ID: <E1mzvGf-00048j-V0@gemulon.postgresql.org>
Permalink:  ../E1mzvGf-00048j-V0@gemulon.postgresql.org/
Also on:    postgresql.org/message-id/E1mzvGf-00048j-V0@gemulon.postgresql.org

 · 

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 from your mail client; the link fills in
  the headers below: reply via email
  Some clients, webmail especially, drop In-Reply-To and References from
  a link, and the reply then starts a new thread: use the mbox below.

  To: pgsql-committers@postgresql.org
  Cc: michael@paquier.xyz
  Subject: Re: pgsql: Remove assertion for ALTER TABLE .. DETACH PARTITION CONCURRENTL
  In-Reply-To: <E1mzvGf-00048j-V0@gemulon.postgresql.org>
  References: <E1mzvGf-00048j-V0@gemulon.postgresql.org>

* 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