pg.ddx.io pgsql-committers@postgresql.org mailing list archivehelp / color / mirror / Atom feed
pgsql: Fix droppability of constraints upon partition detach 2+ messages / 1 participants [nested] [flat]
* pgsql: Fix droppability of constraints upon partition detach @ 2019-01-24 17:10 Alvaro Herrera <alvherre@alvh.no-ip.org> 0 siblings, 0 replies; 2+ messages in thread From: Alvaro Herrera @ 2019-01-24 17:10 UTC (permalink / raw) To: pgsql-committers@lists.postgresql.org Fix droppability of constraints upon partition detach We were failing to set conislocal correctly for constraints in partitions after partition detach, leading to those constraints becoming undroppable. Fix by setting the flag correctly. Existing databases might contain constraints with the conislocal wrongly set to false, for partitions that were detached; this situation should be fixable by applying an UPDATE on pg_constraint to set conislocal true. This problem should otherwise be innocuous and should disappear across a dump/restore or pg_upgrade. Secondarily, when constraint drop was attempted in a partitioned table, ATExecDropConstraint would try to recurse to partitions after doing performDeletion() of the constraint in the partitioned table itself; but since the constraint in the partitions are dropped by the initial call of performDeletion() (because of following dependencies), the recursion step would fail since it would not find the constraint, causing the whole operation to fail. Fix by preventing recursion. Reported-by: Amit Langote Diagnosed-by: Amit Langote Author: Amit Langote, Álvaro Herrera Discussion: https://postgr.es/m/f2b8ead5-4131-d5a8-8016-2ea0a31250af@lab.ntt.co.jp Branch ------ REL_11_STABLE Details ------- https://git.postgresql.org/pg/commitdiff/1ad5210998e33cccb4ea97b33837f19193d1011d Modified Files -------------- src/backend/catalog/pg_constraint.c | 12 ++++++++++-- src/backend/commands/tablecmds.c | 24 ++++++++++++++++++++++-- src/test/regress/expected/foreign_key.out | 20 ++++++++++++++++++-- src/test/regress/sql/foreign_key.sql | 16 +++++++++++++++- 4 files changed, 65 insertions(+), 7 deletions(-) ^ permalink raw reply [nested|flat] 2+ messages in thread
* pgsql: Fix droppability of constraints upon partition detach @ 2019-01-24 17:10 Alvaro Herrera <alvherre@alvh.no-ip.org> 0 siblings, 0 replies; 2+ messages in thread From: Alvaro Herrera @ 2019-01-24 17:10 UTC (permalink / raw) To: pgsql-committers@lists.postgresql.org Fix droppability of constraints upon partition detach We were failing to set conislocal correctly for constraints in partitions after partition detach, leading to those constraints becoming undroppable. Fix by setting the flag correctly. Existing databases might contain constraints with the conislocal wrongly set to false, for partitions that were detached; this situation should be fixable by applying an UPDATE on pg_constraint to set conislocal true. This problem should otherwise be innocuous and should disappear across a dump/restore or pg_upgrade. Secondarily, when constraint drop was attempted in a partitioned table, ATExecDropConstraint would try to recurse to partitions after doing performDeletion() of the constraint in the partitioned table itself; but since the constraint in the partitions are dropped by the initial call of performDeletion() (because of following dependencies), the recursion step would fail since it would not find the constraint, causing the whole operation to fail. Fix by preventing recursion. Reported-by: Amit Langote Diagnosed-by: Amit Langote Author: Amit Langote, Álvaro Herrera Discussion: https://postgr.es/m/f2b8ead5-4131-d5a8-8016-2ea0a31250af@lab.ntt.co.jp Branch ------ master Details ------- https://git.postgresql.org/pg/commitdiff/efd9366dcedec8db9fc85e77d071b0c5a6badea2 Modified Files -------------- src/backend/catalog/pg_constraint.c | 12 ++++++++++-- src/backend/commands/tablecmds.c | 26 +++++++++++++++++++++++--- src/test/regress/expected/foreign_key.out | 20 ++++++++++++++++++-- src/test/regress/sql/foreign_key.sql | 16 +++++++++++++++- 4 files changed, 66 insertions(+), 8 deletions(-) ^ permalink raw reply [nested|flat] 2+ messages in thread
end of thread, other threads:[~2019-01-24 17:10 UTC | newest] Thread overview: 2+ messages (download: mbox mbox.gz follow: Atom feed) -- links below jump to the message on this page -- 2019-01-24 17:10 pgsql: Fix droppability of constraints upon partition detach Alvaro Herrera <alvherre@alvh.no-ip.org> 2019-01-24 17:10 pgsql: Fix droppability of constraints upon partition detach Alvaro Herrera <alvherre@alvh.no-ip.org>
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