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

From: Michael Paquier <michael(at)paquier(dot)xyz>
To: exclusion(at)gmail(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-20 12:38:03
Message-ID: YcB5K6/Mrh9X82lG@paquier.xyz
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-bugs

On Sun, Dec 19, 2021 at 06:00:02AM +0000, PG Bug reporting form wrote:
> CREATE SEQUENCE seq;
> CREATE TABLE range_parted(a int) PARTITION BY RANGE(a);
> ALTER TABLE range_parted DETACH PARTITION seq CONCURRENTLY;

The same error happens additionally for views or materialized views.
Looking at the code, I think that we should just apply
ATSimplePermissions() on (ATT_TABLE | ATT_FOREIGN_TABLE) when
executing the detach command to check for the supported relkinds.
That would make the logic consistent with the attach code path that
does the same check on the partition attached, while generating an
error message already generic enough for this purpose.

Attached is a patch, with some regression tests.
--
Michael

Attachment Content-Type Size
partition-detach-assert.patch text/x-diff 3.2 KB

In response to

Responses

Browse pgsql-bugs by date

  From Date Subject
Next Message Peter Eisentraut 2021-12-20 20:57:47 Re: BUG #17339: Assert failed on attempt to detach a sequence concurrently
Previous Message PG Bug reporting form 2021-12-20 10:38:28 BUG #17340: Unnest discards rows with empty or null arrays