[MASSMAIL]pgsql: Add support for MERGE ... WHEN NOT MATCHED BY SOURCE. - Mailing list pgsql-committers

From Dean Rasheed
Subject [MASSMAIL]pgsql: Add support for MERGE ... WHEN NOT MATCHED BY SOURCE.
Date
Msg-id E1rqVZH-006TRK-1p@gemulon.postgresql.org
Whole thread Raw
List pgsql-committers
Add support for MERGE ... WHEN NOT MATCHED BY SOURCE.

This allows MERGE commands to include WHEN NOT MATCHED BY SOURCE
actions, which operate on rows that exist in the target relation, but
not in the data source. These actions can execute UPDATE, DELETE, or
DO NOTHING sub-commands.

This is in contrast to already-supported WHEN NOT MATCHED actions,
which operate on rows that exist in the data source, but not in the
target relation. To make this distinction clearer, such actions may
now be written as WHEN NOT MATCHED BY TARGET.

Writing WHEN NOT MATCHED without specifying BY SOURCE or BY TARGET is
equivalent to writing WHEN NOT MATCHED BY TARGET.

Dean Rasheed, reviewed by Alvaro Herrera, Ted Yu and Vik Fearing.

Discussion: https://postgr.es/m/CAEZATCWqnKGc57Y_JanUBHQXNKcXd7r=0R4NEZUVwP+syRkWbA@mail.gmail.com

Branch
------
master

Details
-------
https://git.postgresql.org/pg/commitdiff/0294df2f1f842dfb0eed79007b21016f486a3c6c

Modified Files
--------------
doc/src/sgml/mvcc.sgml                        |  12 +-
doc/src/sgml/ref/merge.sgml                   | 100 +++++--
src/backend/executor/execMain.c               |   6 +-
src/backend/executor/execPartition.c          |  21 +-
src/backend/executor/nodeModifyTable.c        | 387 ++++++++++++++++----------
src/backend/nodes/nodeFuncs.c                 |   3 +
src/backend/optimizer/plan/createplan.c       |   8 +-
src/backend/optimizer/plan/planner.c          |  22 ++
src/backend/optimizer/plan/setrefs.c          |  20 +-
src/backend/optimizer/prep/prepjointree.c     |  51 +++-
src/backend/optimizer/prep/preptlist.c        |  26 +-
src/backend/optimizer/util/pathnode.c         |   5 +-
src/backend/parser/gram.y                     |  62 +++--
src/backend/parser/parse_merge.c              |  56 ++--
src/backend/utils/adt/ruleutils.c             |  41 ++-
src/bin/psql/tab-complete.c                   |  30 +-
src/include/catalog/catversion.h              |   2 +-
src/include/nodes/execnodes.h                 |  15 +-
src/include/nodes/parsenodes.h                |   7 +-
src/include/nodes/pathnodes.h                 |   2 +
src/include/nodes/plannodes.h                 |   2 +
src/include/nodes/primnodes.h                 |  10 +-
src/include/optimizer/pathnode.h              |   3 +-
src/include/parser/kwlist.h                   |   2 +
src/test/isolation/expected/merge-update.out  |  88 ++++--
src/test/isolation/specs/merge-update.spec    |  10 +-
src/test/regress/expected/merge.out           | 299 +++++++++++++++-----
src/test/regress/expected/rules.out           |  32 +++
src/test/regress/expected/updatable_views.out |  90 ++++++
src/test/regress/sql/merge.sql                | 122 ++++++--
src/test/regress/sql/rules.sql                |  19 ++
src/test/regress/sql/updatable_views.sql      |  32 +++
src/tools/pgindent/typedefs.list              |   1 +
33 files changed, 1226 insertions(+), 360 deletions(-)


pgsql-committers by date:

Previous
From: Jeff Davis
Date:
Subject: pgsql: Add unicode_strtitle() for Unicode Default Case Conversion.
Next
From: Alvaro Herrera
Date:
Subject: [MASSMAIL]pgsql: doc: Improve "Partition Maintenance" section