Re: SQL:2011 Application Time Update & Delete
Peter Eisentraut <peter@eisentraut.org>
From: Peter Eisentraut <peter@eisentraut.org>
To: Paul A Jungwirth <pj@illuminatedcomputing.com>
Cc: Chao Li <li.evan.chao@gmail.com>,
PostgreSQL Hackers <pgsql-hackers@lists.postgresql.org>
Date: 2026-01-08T16:03:02Z
Lists: pgsql-hackers
Attachments
- 0001-Record-range-constructor-functions-in-pg_range.patch (text/plain) patch 0001
On 06.12.25 01:42, Paul A Jungwirth wrote: >> transformForPortionOfClause(): >> >> Using get_typname_and_namespace() to get the name of a range type and >> then using that to construct a function call of the same name is >> fragile. >> >> Also, it leads to unexpected error messages when the types don't >> match: >> >> DELETE FROM for_portion_of_test >> FOR PORTION OF valid_at FROM 1 TO 2; >> ERROR: function pg_catalog.daterange(integer, integer) does not exist >> >> Well, you cover that in the tests, but I don't think it's right. >> >> There should be a way to go into the catalogs and get the correct >> range constructor function for a range type using only OID references. >> Then you can build a FuncExpr node directly and don't need to go the >> detour of building a fake FuncCall node to transform. (You'd still >> need to transform the arguments separately in that case.) > I added a function, get_range_constructor2, which I call to build a > FuncExpr now. I got rid of get_typname_and_namespace. That said, > looking up the constructor is tricky, because there isn't a direct oid > lookup you can make. The rule is that it has the same name as the > rangetype, with two args both matching the subtype. At least the rule > is encapsulated now. And I think this function will be useful for the > PERIODs patch, which needs similar don't-parse-your-own-node-trees > work. How about an alternative approach: We record the required constructor functions in the pg_range catalog, and then just look them up from there. I have put together a quick patch for this, see attached. Maybe we don't need to record all of them. In particular, some of the multirange constructor functions seem to only exist to serve as cast functions. Do you foresee down the road needing to look up any other ones starting from the range type?
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