pg.ddx.io  pgsql-committers@postgresql.org mailing list archive  
help / color / mirror / Atom feed
pgsql: Create action triggers when partitions are detached
2+ messages / 1 participants
[nested] [flat]

* pgsql: Create action triggers when partitions are detached
@ 2019-01-21 23:10  Alvaro Herrera <alvherre@alvh.no-ip.org>
  0 siblings, 0 replies; 2+ messages in thread

From: Alvaro Herrera @ 2019-01-21 23:10 UTC (permalink / raw)
  To: pgsql-committers@lists.postgresql.org

Create action triggers when partitions are detached

Detaching a partition from a partitioned table that's constrained by
foreign keys requires additional action triggers on the referenced side;
otherwise, DELETE/UPDATE actions there fail to notice rows in the table
that was partition, and so are incorrectly allowed through.  With this
commit, those triggers are now created.  Conversely, when a table that
has a foreign key is attached as a partition to a table that also has
the same foreign key, those action triggers are no longer needed, so we
remove them.

Add a minimal test case verifying (part of) this.

Authors: 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/0464fdf07f69452dd67dd798c026d82c956bda33

Modified Files
--------------
src/backend/commands/tablecmds.c          | 71 ++++++++++++++++++++++++++++++-
src/test/regress/expected/foreign_key.out | 28 +++++++++++-
src/test/regress/sql/foreign_key.sql      | 19 ++++++++-
3 files changed, 113 insertions(+), 5 deletions(-)



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

* pgsql: Create action triggers when partitions are detached
@ 2019-01-21 23:10  Alvaro Herrera <alvherre@alvh.no-ip.org>
  0 siblings, 0 replies; 2+ messages in thread

From: Alvaro Herrera @ 2019-01-21 23:10 UTC (permalink / raw)
  To: pgsql-committers@lists.postgresql.org

Create action triggers when partitions are detached

Detaching a partition from a partitioned table that's constrained by
foreign keys requires additional action triggers on the referenced side;
otherwise, DELETE/UPDATE actions there fail to notice rows in the table
that was partition, and so are incorrectly allowed through.  With this
commit, those triggers are now created.  Conversely, when a table that
has a foreign key is attached as a partition to a table that also has
the same foreign key, those action triggers are no longer needed, so we
remove them.

Add a minimal test case verifying (part of) this.

Authors: 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/123cc697a8eb0827e82ceea3f6da55b2f05eb422

Modified Files
--------------
src/backend/commands/tablecmds.c          | 71 ++++++++++++++++++++++++++++++-
src/test/regress/expected/foreign_key.out | 28 +++++++++++-
src/test/regress/sql/foreign_key.sql      | 19 ++++++++-
3 files changed, 113 insertions(+), 5 deletions(-)



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


end of thread, other threads:[~2019-01-21 23: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-21 23:10 pgsql: Create action triggers when partitions are detached Alvaro Herrera <alvherre@alvh.no-ip.org>
2019-01-21 23:10 pgsql: Create action triggers when partitions are detached 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