Skip to content
Permalink

Comparing changes

Choose two branches to see what’s changed or to start a new pull request. If you need to, you can also or learn more about diff comparisons.

Open a pull request

Create a new pull request by comparing changes across two branches. If you need to, you can also . Learn more about diff comparisons here.
base repository: postgresql-cfbot/postgresql
Failed to load repositories. Confirm that selected base ref is valid, then try again.
Loading
base: cf/6241~1
Choose a base ref
...
head repository: postgresql-cfbot/postgresql
Failed to load repositories. Confirm that selected head ref is valid, then try again.
Loading
compare: cf/6241
Choose a head ref
  • 1 commit
  • 10 files changed
  • 1 contributor

Commits on Nov 22, 2025

  1. Add range_minus_multi and multirange_minus_multi functions

    The existing range_minus function raises an exception when the range is
    "split", because then the result can't be represented by a single range.
    For example '[0,10)'::int4range - '[4,5)' would be '[0,4)' and '[5,10)'.
    
    This commit adds new set-returning functions so that callers can get
    results even in the case of splits. There is no risk of an exception for
    multiranges, but a set-returning function lets us handle them the same
    way we handle ranges.
    
    Both functions return zero results if the subtraction would give an
    empty range/multirange.
    
    The main use-case for these functions is to implement UPDATE/DELETE FOR
    PORTION OF, which must compute the application-time of "temporal
    leftovers": the part of history in an updated/deleted row that was not
    changed. To preserve the untouched history, we will implicitly insert
    one record for each result returned by range/multirange_minus_multi.
    Using a set-returning function will also let us support user-defined
    types for application-time update/delete in the future.
    
    Author: Paul A. Jungwirth <pj@illuminatedcomputing.com>
    Reviewed-by: Peter Eisentraut <peter@eisentraut.org>
    Reviewed-by: Chao Li <li.evan.chao@gmail.com>
    Discussion: https://www.postgresql.org/message-id/flat/ec498c3d-5f2b-48ec-b989-5561c8aa2024%40illuminatedcomputing.com
    petere committed Nov 22, 2025
    Configuration menu
    Copy the full SHA
    5eed8ce View commit details
    Browse the repository at this point in the history
Loading