pgsql: Test what BEFORE UPDATE triggers do to FOR PORTION OF

From: Peter Eisentraut <peter(at)eisentraut(dot)org>
To: pgsql-committers(at)lists(dot)postgresql(dot)org
Subject: pgsql: Test what BEFORE UPDATE triggers do to FOR PORTION OF
Date: 2026-07-21 06:50:05
Message-ID: E1wm4In-000000008FJ-1qDE@gemulon.postgresql.org
Views: Whole Thread | Raw Message | Download mbox | Resend email
Thread:
Lists: pgsql-committers

Test what BEFORE UPDATE triggers do to FOR PORTION OF

If a BEFORE trigger changes NEW.valid_at, what is the interaction with
FOR PORTION OF? This commit gives a test to capture our current
behavior: The trigger's change replaces the value we computed
automatically, but it does not change the bounds of the temporal
leftovers.

This matches the behavior of MariaDB. On the other hand, DB2 rejects
changing the start/end columns of a PERIOD. Since we don't have
PERIODs, we can't reject the change at trigger definition time as DB2
does, but we could reject it at run time by comparing the values
before and after running triggers.

Author: Paul A. Jungwirth <pj(at)illuminatedcomputing(dot)com>
Discussion: https://www.postgresql.org/message-id/CA%2BrenyV3Cr9BvWsPeb1t8b%3DPk24apuzyGbubAEs_YsgLUTfXpg%40mail.gmail.com

Branch
------
master

Details
-------
https://git.postgresql.org/pg/commitdiff/9170c8b71693cf76a4b9a9fbcd16b1fb20b3357c

Modified Files
--------------
src/test/regress/expected/for_portion_of.out | 47 ++++++++++++++++++++++++++++
src/test/regress/sql/for_portion_of.sql | 47 ++++++++++++++++++++++++++++
2 files changed, 94 insertions(+)

Browse pgsql-committers by date

  From Date Subject
Next Message Michael Paquier 2026-07-21 07:58:50 pgsql: Improve generate_partition_qual()'s cache handling on out-of-mem
Previous Message Amit Kapila 2026-07-21 04:02:06 pgsql: Allow logical replication workers to ignore default_transaction_