pgsql: Fix assertion failure with ALTER TABLE ATTACH PARTITION and inde

From: Michael Paquier <michael(at)paquier(dot)xyz>
To: pgsql-committers(at)lists(dot)postgresql(dot)org
Subject: pgsql: Fix assertion failure with ALTER TABLE ATTACH PARTITION and inde
Date: 2020-03-03 04:57:34
Message-ID: E1j8zcc-0005fY-7W@gemulon.postgresql.org
Views: Whole Thread | Raw Message | Download mbox | Resend email
Thread:
Lists: pgsql-committers

Fix assertion failure with ALTER TABLE ATTACH PARTITION and indexes

Using ALTER TABLE ATTACH PARTITION causes an assertion failure when
attempting to work on a partitioned index, because partitioned indexes
cannot have partition bounds.

The grammar of ALTER TABLE ATTACH PARTITION requires partition bounds,
but not ALTER INDEX, so mixing ALTER TABLE with partitioned indexes is
confusing. Hence, on HEAD, prevent ALTER TABLE to attach a partition if
the relation involved is a partitioned index. On back-branches, as
applications may rely on the existing behavior, just remove the
culprit assertion.

Reported-by: Alexander Lakhin
Author: Amit Langote, Michael Paquier
Discussion: https://postgr.es/m/16276-5cd1dcc8fb8be7b5@postgresql.org
Backpatch-through: 11

Branch
------
REL_12_STABLE

Details
-------
https://git.postgresql.org/pg/commitdiff/dc8364824f80cf60f8d2f5a617b0470992e293dd

Modified Files
--------------
src/backend/parser/parse_utilcmd.c | 1 -
src/test/regress/expected/indexing.out | 16 ++++++++++++++++
src/test/regress/sql/indexing.sql | 10 ++++++++++
3 files changed, 26 insertions(+), 1 deletion(-)

Browse pgsql-committers by date

  From Date Subject
Next Message Peter Geoghegan 2020-03-03 05:40:50 pgsql: Remove overzealous _bt_split() assertions.
Previous Message Fujii Masao 2020-03-03 03:27:20 pgsql: Fix the name of the first WAL segment file, in docs.