Re: BUG #16276: Server crash on an invalid attempt to attach apartition to an index - Mailing list pgsql-bugs

From Michael Paquier
Subject Re: BUG #16276: Server crash on an invalid attempt to attach apartition to an index
Date
Msg-id 20200303050122.GG32059@paquier.xyz
Whole thread Raw
In response to Re: BUG #16276: Server crash on an invalid attempt to attach apartition to an index  (Amit Langote <amitlangote09@gmail.com>)
Responses Re: BUG #16276: Server crash on an invalid attempt to attach apartition to an index  (Amit Langote <amitlangote09@gmail.com>)
List pgsql-bugs
On Mon, Mar 02, 2020 at 07:39:44PM +0900, Amit Langote wrote:
> Done, please see attached.

Thanks.  There are actually some safeguards in ATPrepCmd()@tablecmds.c
when calling ATSimplePermissions().  However, as this is checked for
both (ATT_TABLE | ATT_PARTITIONED_INDEX) then it would not blow up as
ALTER INDEX and ALTER TABLE use the same code path.  Using DETACH
partition triggers this code path's error though, making the hint
added in your patch actually correct.

So, applied this stuff down to 11, with test cases on all branches.  I
have added a test case with ALTER TABLE DETACH PARTITION for an index
while on it.  As the error is triggered at transformation time which
is a tad more generic than the work done in tablecmds.c for each
command, I have also removed the error hint and kept the code
simpler.
--
Michael

Attachment

pgsql-bugs by date:

Previous
From: Alvaro Herrera
Date:
Subject: Re: BUG #16285: bt_metap fails with value is out of range for typeinteger
Next
From: Amit Kapila
Date:
Subject: Re: ERROR: subtransaction logged without previous top-level txn record