pg.ddx.io  pgsql-committers@postgresql.org mailing list archive  
help / color / mirror / Atom feed
pgsql: Fix SET CONSTRAINTS .. DEFERRED on partitioned tables
3+ messages / 1 participants
[nested] [flat]

* pgsql: Fix SET CONSTRAINTS .. DEFERRED on partitioned tables
@ 2019-11-07 17:28  Alvaro Herrera <alvherre@alvh.no-ip.org>
  0 siblings, 0 replies; 3+ messages in thread

From: Alvaro Herrera @ 2019-11-07 17:28 UTC (permalink / raw)
  To: pgsql-committers@lists.postgresql.org

Fix SET CONSTRAINTS .. DEFERRED on partitioned tables

SET CONSTRAINTS ... DEFERRED failed on partitioned tables, because of a
sanity check that ensures that the affected constraints have triggers.
On partitioned tables, the triggers are in the leaf partitions, not in
the partitioned relations themselves, so the sanity check fails.
Removing the sanity check solves the problem, because the code needed to
support the case is already there.

Backpatch to 11.

Note: deferred unique constraints are not affected by this bug, because
they do have triggers in the parent partitioned table.  I did not add a
test for this scenario.

Discussion: https://postgr.es/m/20191105212915.GA11324@alvherre.pgsql

Branch
------
REL_12_STABLE

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

Modified Files
--------------
src/backend/commands/trigger.c            | 10 ------
src/test/regress/expected/foreign_key.out | 56 +++++++++++++++++++++++++++++--
src/test/regress/sql/foreign_key.sql      | 45 ++++++++++++++++++++++++-
3 files changed, 97 insertions(+), 14 deletions(-)



^ permalink  raw  reply  [nested|flat] 3+ messages in thread

* pgsql: Fix SET CONSTRAINTS .. DEFERRED on partitioned tables
@ 2019-11-07 17:28  Alvaro Herrera <alvherre@alvh.no-ip.org>
  0 siblings, 0 replies; 3+ messages in thread

From: Alvaro Herrera @ 2019-11-07 17:28 UTC (permalink / raw)
  To: pgsql-committers@lists.postgresql.org

Fix SET CONSTRAINTS .. DEFERRED on partitioned tables

SET CONSTRAINTS ... DEFERRED failed on partitioned tables, because of a
sanity check that ensures that the affected constraints have triggers.
On partitioned tables, the triggers are in the leaf partitions, not in
the partitioned relations themselves, so the sanity check fails.
Removing the sanity check solves the problem, because the code needed to
support the case is already there.

Backpatch to 11.

Note: deferred unique constraints are not affected by this bug, because
they do have triggers in the parent partitioned table.  I did not add a
test for this scenario.

Discussion: https://postgr.es/m/20191105212915.GA11324@alvherre.pgsql

Branch
------
master

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

Modified Files
--------------
src/backend/commands/trigger.c            | 10 ------
src/test/regress/expected/foreign_key.out | 56 +++++++++++++++++++++++++++++--
src/test/regress/sql/foreign_key.sql      | 45 ++++++++++++++++++++++++-
3 files changed, 97 insertions(+), 14 deletions(-)



^ permalink  raw  reply  [nested|flat] 3+ messages in thread

* pgsql: Fix SET CONSTRAINTS .. DEFERRED on partitioned tables
@ 2019-11-07 17:28  Alvaro Herrera <alvherre@alvh.no-ip.org>
  0 siblings, 0 replies; 3+ messages in thread

From: Alvaro Herrera @ 2019-11-07 17:28 UTC (permalink / raw)
  To: pgsql-committers@lists.postgresql.org

Fix SET CONSTRAINTS .. DEFERRED on partitioned tables

SET CONSTRAINTS ... DEFERRED failed on partitioned tables, because of a
sanity check that ensures that the affected constraints have triggers.
On partitioned tables, the triggers are in the leaf partitions, not in
the partitioned relations themselves, so the sanity check fails.
Removing the sanity check solves the problem, because the code needed to
support the case is already there.

Backpatch to 11.

Note: deferred unique constraints are not affected by this bug, because
they do have triggers in the parent partitioned table.  I did not add a
test for this scenario.

Discussion: https://postgr.es/m/20191105212915.GA11324@alvherre.pgsql

Branch
------
REL_11_STABLE

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

Modified Files
--------------
src/backend/commands/trigger.c            | 10 ----------
src/test/regress/expected/foreign_key.out | 21 +++++++++++++++++++--
src/test/regress/sql/foreign_key.sql      | 20 +++++++++++++++++++-
3 files changed, 38 insertions(+), 13 deletions(-)



^ permalink  raw  reply  [nested|flat] 3+ messages in thread


end of thread, other threads:[~2019-11-07 17:28 UTC | newest]

Thread overview: 3+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2019-11-07 17:28 pgsql: Fix SET CONSTRAINTS .. DEFERRED on partitioned tables Alvaro Herrera <alvherre@alvh.no-ip.org>
2019-11-07 17:28 pgsql: Fix SET CONSTRAINTS .. DEFERRED on partitioned tables Alvaro Herrera <alvherre@alvh.no-ip.org>
2019-11-07 17:28 pgsql: Fix SET CONSTRAINTS .. DEFERRED on partitioned tables 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