Re: SQL:2011 Application Time Update & Delete
Paul A Jungwirth <pj@illuminatedcomputing.com>
From: Paul A Jungwirth <pj@illuminatedcomputing.com>
To: PostgreSQL Hackers <pgsql-hackers@lists.postgresql.org>
Cc: Tom Lane <tgl@sss.pgh.pa.us>, Robert Haas <robertmhaas@gmail.com>, Peter Eisentraut <peter@eisentraut.org>
Date: 2025-09-25T04:05:41Z
Lists: pgsql-hackers
Attachments
- v54-0003-Document-temporal-PERIODs.patch (application/octet-stream) patch v54-0003
- v54-0002-Document-temporal-foreign-keys.patch (application/octet-stream) patch v54-0002
- v54-0001-Add-docs-chapter-for-temporal-tables.patch (application/octet-stream) patch v54-0001
- v54-0005-Add-range_minus_multi-and-multirange_minus_multi.patch (application/octet-stream) patch v54-0005
- v54-0007-Add-tg_temporal-to-TriggerData.patch (application/octet-stream) patch v54-0007
- v54-0006-Add-UPDATE-DELETE-FOR-PORTION-OF.patch (application/octet-stream) patch v54-0006
- v54-0004-Document-temporal-update-delete.patch (application/octet-stream) patch v54-0004
- v54-0008-Look-up-more-temporal-foreign-key-helper-procs.patch (application/octet-stream) patch v54-0008
- v54-0009-Add-CASCADE-SET-NULL-SET-DEFAULT-for-temporal-fo.patch (application/octet-stream) patch v54-0009
- v54-0010-Expose-FOR-PORTION-OF-to-plpgsql-triggers.patch (application/octet-stream) patch v54-0010
- v54-0011-Add-PERIODs.patch (application/octet-stream) patch v54-0011
On Fri, Aug 29, 2025 at 6:03 AM Paul A Jungwirth
<pj@illuminatedcomputing.com> wrote:
> I'm still working on the PERIOD DDL, but that doesn't have to go in at
> the same time. The tricky part is ALTER TABLE ADD PERIOD, where I need
> to wait until the add-columns pass to see the start/end columns'
> type/etc, but then in that same pass I need to add a generated range
> column. If I add the column in a later pass, I get a failure, e.g.
> "cannot ALTER TABLE "pt" because it is being used by active queries in
> this session". This only appeared with recent(ish) NOT NULL work. I
> think the solution is to avoid holding a relcache entry longer than
> needed, but I haven't had a chance to locate the issue yet.
Here is another update, now with working PERIOD DDL. I also fixed some
new post-rebase problems causing CI to fail.
There is a detailed wiki page attached to the commitfest entry. To
summarize the patches here:
- Four documentation patches adding a new chapter introducing temporal
concepts. This are split out by topic: primary key + unique
constraints, foreign keys, PERIODs, and UPDATE/DELETE FOR PORTION OF.
- Two patches adding UPDATE/DELETE FOR PORTION OF. (I broke out the
helper functions that compute temporal leftovers.)
- Some patches adding CASCADE/SET NULL/SET DEFAULT to temporal foreign
keys. Once you have UPDATE/DELETE FOR PORTION OF, these are easy. You
do need to know the FOR PORTION OF bounds though, so one of the
patches adds that to the TriggerData struct.
- A patch to add the same bounds info to PL/pgSQL trigger variables.
- A patch to add PERIOD DDL support, based on hidden GENERATED
rangetype columns.
Rebased to d96c854dfc.
Yours,
--
Paul ~{:-)
pj@illuminatedcomputing.com
Commits
Same data as JSON:
GET /api/v1/messages/:b64id/commits
the thread's linked commits as JSON, with link sources.
API reference →
-
Make ExecForPortionOfLeftovers() obey SRF protocol.
- 207cb2abcba0 19 (unreleased) landed
-
Add isolation tests for UPDATE/DELETE FOR PORTION OF
- b6ccd30d8ff6 19 (unreleased) landed
-
Add UPDATE/DELETE FOR PORTION OF
- 8e72d914c528 19 (unreleased) landed
-
Record range constructor functions in pg_range
- c257ba839718 19 (unreleased) landed
-
Add range_minus_multi and multirange_minus_multi functions
- 5eed8ce50ce9 19 (unreleased) landed
-
doc: Add section for temporal tables
- e4d8a2af07f5 19 (unreleased) landed
-
Add assertion check for WAL receiver state during stream-archive transition
- 65f4976189b6 19 (unreleased) cited