pg.ddx.io  pgsql-committers@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Alvaro Herrera <alvherre@alvh.no-ip.org>
To: pgsql-committers@lists.postgresql.org
Subject: pgsql: Fix event triggers for partitioned tables
Date: Sat, 06 Oct 2018 22:18:46 +0000
Message-ID: <E1g8uuM-00056u-Cu@gemulon.postgresql.org> (raw)

Fix event triggers for partitioned tables

Index DDL cascading on partitioned tables introduced a way for ALTER
TABLE to be called reentrantly.  This caused an an important deficiency
in event trigger support to be exposed: on exiting the reentrant call,
the alter table state object was clobbered, causing a crash when the
outer alter table tries to finalize its processing.  Fix the crash by
creating a stack of event trigger state objects.  There are still ways
to cause things to misbehave (and probably other crashers) with more
elaborate tricks, but at least it now doesn't crash in the obvious
scenario.

Backpatch to 9.5, where DDL deparsing of event triggers was introduced.

Reported-by: Marco Slot
Authors: Michaël Paquier, Álvaro Herrera
Discussion: https://postgr.es/m/CANNhMLCpi+HQ7M36uPfGbJZEQLyTy7XvX=5EFkpR-b1bo0uJew@mail.gmail.com

Branch
------
master

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

Modified Files
--------------
src/backend/catalog/index.c                          |  8 +++++++-
src/backend/commands/event_trigger.c                 | 13 +++++++------
src/backend/commands/indexcmds.c                     |  3 ++-
src/backend/commands/tablecmds.c                     |  2 +-
src/backend/commands/view.c                          |  4 ++++
src/include/catalog/index.h                          |  3 ++-
src/include/tcop/deparse_utility.h                   |  3 +++
.../test_ddl_deparse/expected/alter_table.out        | 12 ++++++++++++
.../modules/test_ddl_deparse/sql/alter_table.sql     |  8 ++++++++
src/test/regress/expected/event_trigger.out          | 20 +++++++++++++++++++-
src/test/regress/sql/event_trigger.sql               | 13 +++++++++++++
11 files changed, 78 insertions(+), 11 deletions(-)



view thread (10+ messages)  latest in thread

Message-ID: <E1g8uuM-00056u-Cu@gemulon.postgresql.org>
Permalink:  ../E1g8uuM-00056u-Cu@gemulon.postgresql.org/
Also on:    postgresql.org/message-id/E1g8uuM-00056u-Cu@gemulon.postgresql.org

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients from your mail client; the link fills in
  the headers below: reply via email
  Some clients, webmail especially, drop In-Reply-To and References from
  a link, and the reply then starts a new thread: use the mbox below.

  To: pgsql-committers@postgresql.org
  Cc: alvherre@alvh.no-ip.org
  Subject: Re: pgsql: Fix event triggers for partitioned tables
  In-Reply-To: <E1g8uuM-00056u-Cu@gemulon.postgresql.org>
  References: <E1g8uuM-00056u-Cu@gemulon.postgresql.org>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

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