pgsql: Offer triggers on foreign tables. - Mailing list pgsql-committers

From Noah Misch
Subject pgsql: Offer triggers on foreign tables.
Date
Msg-id E1WRbyA-0005zi-8P@gemulon.postgresql.org
Whole thread Raw
List pgsql-committers
Offer triggers on foreign tables.

This covers all the SQL-standard trigger types supported for regular
tables; it does not cover constraint triggers.  The approach for
acquiring the old row mirrors that for view INSTEAD OF triggers.  For
AFTER ROW triggers, we spool the foreign tuples to a tuplestore.

This changes the FDW API contract; when deciding which columns to
populate in the slot returned from data modification callbacks, writable
FDWs will need to check for AFTER ROW triggers in addition to checking
for a RETURNING clause.

In support of the feature addition, refactor the TriggerFlags bits and
the assembly of old tuples in ModifyTable.

Ronan Dunklau, reviewed by KaiGai Kohei; some additional hacking by me.

Branch
------
master

Details
-------
http://git.postgresql.org/pg/commitdiff/7cbe57c34dec4860243e6d0f81738cfbb6e5d069

Modified Files
--------------
contrib/postgres_fdw/deparse.c                 |   63 ++--
contrib/postgres_fdw/expected/postgres_fdw.out |  319 ++++++++++++++++++
contrib/postgres_fdw/postgres_fdw.c            |    4 +-
contrib/postgres_fdw/sql/postgres_fdw.sql      |  216 ++++++++++++
doc/src/sgml/fdwhandler.sgml                   |   36 +-
doc/src/sgml/ref/create_trigger.sgml           |   43 ++-
doc/src/sgml/trigger.sgml                      |   25 +-
src/backend/commands/tablecmds.c               |    3 +
src/backend/commands/trigger.c                 |  423 +++++++++++++++++++-----
src/backend/executor/nodeModifyTable.c         |   90 ++---
src/backend/rewrite/rewriteHandler.c           |   36 +-
src/include/commands/trigger.h                 |    8 +-
src/test/regress/expected/foreign_data.out     |   37 +++
src/test/regress/sql/foreign_data.sql          |   44 +++
14 files changed, 1145 insertions(+), 202 deletions(-)


pgsql-committers by date:

Previous
From: Noah Misch
Date:
Subject: pgsql: Address ccvalid/ccnoinherit in TupleDesc support functions.
Next
From: Noah Misch
Date:
Subject: pgsql: Address ccvalid/ccnoinherit in TupleDesc support functions.