postgresql/src/include/optimizer
Peter Eisentraut 8e72d914c5 Add UPDATE/DELETE FOR PORTION OF
This is an extension of the UPDATE and DELETE commands to do a
"temporal update/delete" based on a range or multirange column.  The
user can say UPDATE t FOR PORTION OF valid_at FROM '2001-01-01' TO
'2002-01-01' SET ... (or likewise with DELETE) where valid_at is a
range or multirange column.

The command is automatically limited to rows overlapping the targeted
portion, and only history within those bounds is changed.  If a row
represents history partly inside and partly outside the bounds, then
the command truncates the row's application time to fit within the
targeted portion, then it inserts one or more "temporal leftovers":
new rows containing all the original values, except with the
application-time column changed to only represent the untouched part
of history.

To compute the temporal leftovers that are required, we use the *_minus_multi
set-returning functions defined in 5eed8ce50c.

- Added bison support for FOR PORTION OF syntax.  The bounds must be
  constant, so we forbid column references, subqueries, etc. We do
  accept functions like NOW().
- Added logic to executor to insert new rows for the "temporal
  leftover" part of a record touched by a FOR PORTION OF query.
- Documented FOR PORTION OF.
- Added tests.

Author: Paul A. Jungwirth <pj@illuminatedcomputing.com>
Reviewed-by: Peter Eisentraut <peter@eisentraut.org>
Discussion: https://www.postgresql.org/message-id/flat/ec498c3d-5f2b-48ec-b989-5561c8aa2024%40illuminatedcomputing.com
2026-04-01 19:06:03 +02:00
..
appendinfo.h Update copyright for 2026 2026-01-01 13:24:10 -05:00
clauses.h Convert NOT IN sublinks to anti-joins when safe 2026-03-12 09:45:18 +09:00
cost.h Allow for plugin control over path generation strategies. 2026-01-28 11:28:34 -05:00
extendplan.h Update copyright for 2026 2026-01-01 13:24:10 -05:00
geqo.h Update copyright for 2026 2026-01-01 13:24:10 -05:00
geqo_copy.h Update copyright for 2026 2026-01-01 13:24:10 -05:00
geqo_gene.h Update copyright for 2026 2026-01-01 13:24:10 -05:00
geqo_misc.h Update copyright for 2026 2026-01-01 13:24:10 -05:00
geqo_mutation.h Update copyright for 2026 2026-01-01 13:24:10 -05:00
geqo_pool.h Update copyright for 2026 2026-01-01 13:24:10 -05:00
geqo_random.h Update copyright for 2026 2026-01-01 13:24:10 -05:00
geqo_recombination.h Fix typos and inconsistencies in code and comments 2026-01-05 09:19:15 +09:00
geqo_selection.h Update copyright for 2026 2026-01-01 13:24:10 -05:00
inherit.h Update copyright for 2026 2026-01-01 13:24:10 -05:00
joininfo.h Update copyright for 2026 2026-01-01 13:24:10 -05:00
optimizer.h Convert NOT IN sublinks to anti-joins when safe 2026-03-12 09:45:18 +09:00
orclauses.h Update copyright for 2026 2026-01-01 13:24:10 -05:00
paramassign.h Update copyright for 2026 2026-01-01 13:24:10 -05:00
pathnode.h Add UPDATE/DELETE FOR PORTION OF 2026-04-01 19:06:03 +02:00
paths.h Allow for plugin control over path generation strategies. 2026-01-28 11:28:34 -05:00
placeholder.h Update copyright for 2026 2026-01-01 13:24:10 -05:00
plancat.h Replace get_relation_info_hook with build_simple_rel_hook. 2026-03-09 09:48:26 -04:00
planmain.h Update copyright for 2026 2026-01-01 13:24:10 -05:00
planner.h Add an alternative_plan_name field to PlannerInfo. 2026-03-26 16:45:17 -04:00
prep.h Update copyright for 2026 2026-01-01 13:24:10 -05:00
restrictinfo.h Update copyright for 2026 2026-01-01 13:24:10 -05:00
subselect.h Convert NOT IN sublinks to anti-joins when safe 2026-03-12 09:45:18 +09:00
tlist.h Update copyright for 2026 2026-01-01 13:24:10 -05:00