pg.ddx.io  pgsql-committers@postgresql.org mailing list archive  
help / color / mirror / Atom feed
pgsql: Allow FOR EACH ROW triggers on partitioned tables
5+ messages / 3 participants
[nested] [flat]

* pgsql: Allow FOR EACH ROW triggers on partitioned tables
@ 2018-03-23 13:48 Alvaro Herrera <alvherre@alvh.no-ip.org>
  2018-03-25 05:01 ` Re: pgsql: Allow FOR EACH ROW triggers on partitioned tables Andres Freund <andres@anarazel.de>
  0 siblings, 1 reply; 5+ messages in thread

From: Alvaro Herrera @ 2018-03-23 13:48 UTC (permalink / raw)
  To: pgsql-committers@lists.postgresql.org

Allow FOR EACH ROW triggers on partitioned tables

Previously, FOR EACH ROW triggers were not allowed in partitioned
tables.  Now we allow AFTER triggers on them, and on trigger creation we
cascade to create an identical trigger in each partition.  We also clone
the triggers to each partition that is created or attached later.

This means that deferred unique keys are allowed on partitioned tables,
too.

Author: Álvaro Herrera
Reviewed-by: Peter Eisentraut, Simon Riggs, Amit Langote, Robert Haas,
        Thomas Munro
Discussion: https://postgr.es/m/20171229225319.ajltgss2ojkfd3kp@alvherre.pgsql

Branch
------
master

Details
-------
https://git.postgresql.org/pg/commitdiff/86f575948c773b0ec5b0f27066e37dd93a7f0a96

Modified Files
--------------
doc/src/sgml/catalogs.sgml                 |   8 +
doc/src/sgml/ref/create_trigger.sgml       |   7 +
src/backend/catalog/heap.c                 |   1 +
src/backend/catalog/index.c                |   4 +-
src/backend/catalog/pg_constraint.c        |   3 +
src/backend/commands/tablecmds.c           | 150 ++++++++++++-
src/backend/commands/trigger.c             | 313 +++++++++++++++++++++++---
src/backend/commands/typecmds.c            |   1 +
src/backend/tcop/utility.c                 |   3 +-
src/include/catalog/catversion.h           |   2 +-
src/include/catalog/indexing.h             |   2 +
src/include/catalog/pg_constraint.h        |  39 ++--
src/include/catalog/pg_constraint_fn.h     |   1 +
src/include/commands/trigger.h             |   5 +-
src/test/regress/expected/oidjoins.out     |   8 +
src/test/regress/expected/triggers.out     | 344 +++++++++++++++++++++++++++--
src/test/regress/input/constraints.source  |  16 ++
src/test/regress/output/constraints.source |  26 +++
src/test/regress/sql/oidjoins.sql          |   4 +
src/test/regress/sql/triggers.sql          | 234 +++++++++++++++++++-
20 files changed, 1078 insertions(+), 93 deletions(-)



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

* Re: pgsql: Allow FOR EACH ROW triggers on partitioned tables
  2018-03-23 13:48 pgsql: Allow FOR EACH ROW triggers on partitioned tables Alvaro Herrera <alvherre@alvh.no-ip.org>
@ 2018-03-25 05:01 ` Andres Freund <andres@anarazel.de>
  2018-03-26 14:50   ` Re: pgsql: Allow FOR EACH ROW triggers on partitioned tables Alvaro Herrera <alvherre@alvh.no-ip.org>
  0 siblings, 1 reply; 5+ messages in thread

From: Andres Freund @ 2018-03-25 05:01 UTC (permalink / raw)
  To: Alvaro Herrera <alvherre@alvh.no-ip.org>; +Cc: pgsql-committers@lists.postgresql.org

Hi,

On 2018-03-23 13:48:53 +0000, Alvaro Herrera wrote:
> Allow FOR EACH ROW triggers on partitioned tables
> 
> Previously, FOR EACH ROW triggers were not allowed in partitioned
> tables.  Now we allow AFTER triggers on them, and on trigger creation we
> cascade to create an identical trigger in each partition.  We also clone
> the triggers to each partition that is created or attached later.
> 
> This means that deferred unique keys are allowed on partitioned tables,
> too.
> 
> Author: Álvaro Herrera
> Reviewed-by: Peter Eisentraut, Simon Riggs, Amit Langote, Robert Haas,
>         Thomas Munro
> Discussion: https://postgr.es/m/20171229225319.ajltgss2ojkfd3kp@alvherre.pgsql

The inherit.sql here looks like it's racing against the concurrentlys
scheduled triggers.sql according to my new desmoxytes animal:
https://buildfarm.postgresql.org/cgi-bin/show_log.pl?nm=desmoxytes&dt=2018-03-25%2004%3A48%3A01

Greetings,

Andres Freund




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

* Re: pgsql: Allow FOR EACH ROW triggers on partitioned tables
  2018-03-23 13:48 pgsql: Allow FOR EACH ROW triggers on partitioned tables Alvaro Herrera <alvherre@alvh.no-ip.org>
  2018-03-25 05:01 ` Re: pgsql: Allow FOR EACH ROW triggers on partitioned tables Andres Freund <andres@anarazel.de>
@ 2018-03-26 14:50   ` Alvaro Herrera <alvherre@alvh.no-ip.org>
  2018-03-26 15:03     ` Re: pgsql: Allow FOR EACH ROW triggers on partitioned tables Tom Lane <tgl@sss.pgh.pa.us>
  0 siblings, 1 reply; 5+ messages in thread

From: Alvaro Herrera @ 2018-03-26 14:50 UTC (permalink / raw)
  To: Andres Freund <andres@anarazel.de>; +Cc: pgsql-committers@lists.postgresql.org

Andres Freund wrote:

> On 2018-03-23 13:48:53 +0000, Alvaro Herrera wrote:
> > Allow FOR EACH ROW triggers on partitioned tables

> The inherit.sql here looks like it's racing against the concurrentlys
> scheduled triggers.sql according to my new desmoxytes animal:
> https://buildfarm.postgresql.org/cgi-bin/show_log.pl?nm=desmoxytes&dt=2018-03-25%2004%3A48%3A01

You're right -- fixed.

Thanks

-- 
Álvaro Herrera                https://www.2ndQuadrant.com/
PostgreSQL Development, 24x7 Support, Remote DBA, Training & Services




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

* Re: pgsql: Allow FOR EACH ROW triggers on partitioned tables
  2018-03-23 13:48 pgsql: Allow FOR EACH ROW triggers on partitioned tables Alvaro Herrera <alvherre@alvh.no-ip.org>
  2018-03-25 05:01 ` Re: pgsql: Allow FOR EACH ROW triggers on partitioned tables Andres Freund <andres@anarazel.de>
  2018-03-26 14:50   ` Re: pgsql: Allow FOR EACH ROW triggers on partitioned tables Alvaro Herrera <alvherre@alvh.no-ip.org>
@ 2018-03-26 15:03     ` Tom Lane <tgl@sss.pgh.pa.us>
  2018-03-26 15:33       ` Re: pgsql: Allow FOR EACH ROW triggers on partitioned tables Alvaro Herrera <alvherre@alvh.no-ip.org>
  0 siblings, 1 reply; 5+ messages in thread

From: Tom Lane @ 2018-03-26 15:03 UTC (permalink / raw)
  To: Alvaro Herrera <alvherre@alvh.no-ip.org>; +Cc: Andres Freund <andres@anarazel.de>; pgsql-committers@lists.postgresql.org

Alvaro Herrera <alvherre@alvh.no-ip.org> writes:
> Andres Freund wrote:
>> The inherit.sql here looks like it's racing against the concurrentlys
>> scheduled triggers.sql according to my new desmoxytes animal:
>> https://buildfarm.postgresql.org/cgi-bin/show_log.pl?nm=desmoxytes&dt=2018-03-25%2004%3A48%3A01

> You're right -- fixed.

I don't see any push for this?

			regards, tom lane




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

* Re: pgsql: Allow FOR EACH ROW triggers on partitioned tables
  2018-03-23 13:48 pgsql: Allow FOR EACH ROW triggers on partitioned tables Alvaro Herrera <alvherre@alvh.no-ip.org>
  2018-03-25 05:01 ` Re: pgsql: Allow FOR EACH ROW triggers on partitioned tables Andres Freund <andres@anarazel.de>
  2018-03-26 14:50   ` Re: pgsql: Allow FOR EACH ROW triggers on partitioned tables Alvaro Herrera <alvherre@alvh.no-ip.org>
  2018-03-26 15:03     ` Re: pgsql: Allow FOR EACH ROW triggers on partitioned tables Tom Lane <tgl@sss.pgh.pa.us>
@ 2018-03-26 15:33       ` Alvaro Herrera <alvherre@alvh.no-ip.org>
  0 siblings, 0 replies; 5+ messages in thread

From: Alvaro Herrera @ 2018-03-26 15:33 UTC (permalink / raw)
  To: Tom Lane <tgl@sss.pgh.pa.us>; +Cc: Andres Freund <andres@anarazel.de>; pgsql-committers@lists.postgresql.org

Tom Lane wrote:
> Alvaro Herrera <alvherre@alvh.no-ip.org> writes:
> > Andres Freund wrote:
> >> The inherit.sql here looks like it's racing against the concurrentlys
> >> scheduled triggers.sql according to my new desmoxytes animal:
> >> https://buildfarm.postgresql.org/cgi-bin/show_log.pl?nm=desmoxytes&dt=2018-03-25%2004%3A48%3A01
> 
> > You're right -- fixed.
> 
> I don't see any push for this?

Oops.  It went out later together with another commit.

-- 
Álvaro Herrera                https://www.2ndQuadrant.com/
PostgreSQL Development, 24x7 Support, Remote DBA, Training & Services




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


end of thread, other threads:[~2018-03-26 15:33 UTC | newest]

Thread overview: 5+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2018-03-23 13:48 pgsql: Allow FOR EACH ROW triggers on partitioned tables Alvaro Herrera <alvherre@alvh.no-ip.org>
2018-03-25 05:01 ` Andres Freund <andres@anarazel.de>
2018-03-26 14:50   ` Alvaro Herrera <alvherre@alvh.no-ip.org>
2018-03-26 15:03     ` Tom Lane <tgl@sss.pgh.pa.us>
2018-03-26 15:33       ` 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