postgresql/src/tools
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
..
ci ci: Improve OpenBSD core dump backtrace handling. 2025-11-06 21:14:05 +13:00
editors Make Emacs perl-mode indent more like perltidy. 2019-01-13 11:32:31 -08:00
ifaddrs Update copyright for 2026 2026-01-01 13:24:10 -05:00
perlcheck Activate perlcritic InputOutput::RequireCheckedSyscalls and fix resulting warnings 2024-03-19 07:09:31 +01:00
pg_bsd_indent Fix additional fallthrough warnings from clang 2026-02-23 07:40:19 +01:00
pginclude headerscheck: Avoid mutual inclusion of pg_config.h and c.h 2026-03-30 10:14:41 +02:00
pgindent Add UPDATE/DELETE FOR PORTION OF 2026-04-01 19:06:03 +02:00
add_commit_links.pl Update copyright for 2026 2026-01-01 13:24:10 -05:00
ccsym
check_bison_recursion.pl Update copyright for 2026 2026-01-01 13:24:10 -05:00
copyright.pl Update copyright for 2026 2026-01-01 13:24:10 -05:00
darwin_sysroot Move darwin sysroot determination into separate file 2022-09-01 16:54:19 -07:00
find_badmacros
find_meson meson: Add initial version of meson based build system 2022-09-21 22:37:17 -07:00
find_static Fix trap in a few shell scripts 2022-09-20 18:50:16 +02:00
find_typedef Refer to OS X as "macOS", except for the port name which is still "darwin". 2016-09-25 15:40:57 -04:00
gen_export.pl Restore AIX support. 2026-02-23 13:34:22 -05:00
gen_keywordlist.pl Update copyright for 2026 2026-01-01 13:24:10 -05:00
generate_editorconfig.py Add script to keep .editorconfig in sync with .gitattributes 2025-02-01 10:09:45 +01:00
git-external-diff Preserve information on use of git-external-diff 2018-05-24 23:45:31 +09:30
git_changelog Update copyright for 2026 2026-01-01 13:24:10 -05:00
install_files meson: make install_test_files more generic, rename to install_files 2023-03-23 21:20:18 -07:00
make_ctags Fix make_etags breakage on certain platforms. 2023-06-14 11:02:50 +09:00
make_etags Fix make_etags failure on Mac. 2023-02-15 09:52:42 +09:00
make_mkid
mark_pgdllimport.pl Update copyright for 2026 2026-01-01 13:24:10 -05:00
msvc_gendef.pl MSVC: Support building for AArch64. 2026-01-07 13:42:57 -06:00
PerfectHash.pm Update copyright for 2026 2026-01-01 13:24:10 -05:00
pgflex pgflex: propagate environment to flex subprocess 2025-06-30 12:24:48 +02:00
pgtest pgtest: fix spacing 2023-08-14 14:03:29 -04:00
rcgen meson: Add windows resource files 2022-10-05 09:56:05 -07:00
RELEASE_CHANGES Update RELEASE_CHANGES 2026-03-18 13:42:06 +01:00
testwrap Add 'make check-tests' behavior to the meson based builds 2025-11-21 17:12:22 -05:00
valgrind.supp Fix typos and inconsistencies in code and comments 2026-01-05 09:19:15 +09:00
version_stamp.pl Update copyright for 2026 2026-01-01 13:24:10 -05:00
win32tzlist.pl Update copyright for 2026 2026-01-01 13:24:10 -05:00