Re: SQL:2011 application time - Mailing list pgsql-hackers
From | Robert Haas |
---|---|
Subject | Re: SQL:2011 application time |
Date | |
Msg-id | CA+Tgmoaxx6VUvr6werdV235M2aPWp4GG_QpM_MFofbnermixRQ@mail.gmail.com Whole thread Raw |
In response to | SQL:2011 application time (Paul A Jungwirth <pj@illuminatedcomputing.com>) |
List | pgsql-hackers |
On Thu, May 8, 2025 at 1:36 PM Paul A Jungwirth <pj@illuminatedcomputing.com> wrote: > v51 attached, just rebasing to b560ce7884. I think these patches would benefit from some work to make them more understandable for people who don't already know what they're intended to accomplish. I suspect that's actually a prerequisite to committing them. I started by opening up v51-0001, and the commit message told me this: This new support proc is used by UPDATE/DELETE FOR PORTION OF to compute leftovers that weren't touched by the UPDATE/DELETE. This commit defines implementations for ranges and multiranges. But there is no such thing as FOR PORTION OF just yet, so this is a forward reference. I had to open v51-0002 to try to figure it out. Ideally, concepts get introduced before they're used. The rest of the commit message for v51-0001 reads like this: The procs return SETOF their input type and work like minus but don't fail on splits. The results never contain empty elements. For someone familiar with this work, this probably makes sense, but I'm not and it doesn't. I don't even understand to what "work like minus but don't fail on splits" is intended to refer. I mean, is there some existing minus thing? I don't see it among the GIST_*_PROC symbols, and I don't know where else I'd go looking. As I read through the documentation changes, I find that you use terms like "leftovers" or "leftover row" in various parts of the documentation that are quite far away from and not obviously linked to the documentation of FOR PORTION OF. I think that's going to be very confusing. In other places where we used specialized terms like this, we often using <xref> or <link> to reference the place where the term is defined. You don't really quite have a place where that happens, though, although maybe linking to the documentation of FOR PORTION OF would be good enough. The documentation of FOR PORTION OF makes more sense to me for range types than for multirange types. I gather that if I have a range like [1,10] and I deleted from 3 to 6, I'm going to end up with two ranges. I'm not sure whether 3 or 6 are inclusive or exclusive bounds, so I don't know if I should expect to end up with [1,3) and (6,10] or [1,3] and [6,10], and I kind of wonder if I should get to say which one I want, but anyway now I have two records, my original one having been split. But if [1,10] is a multirange, it's unnecessary to split the record in two in order to accommodate a deletion: i can just include both sub-ranges in the original value. But the documentation doesn't seem to mention this one way or the other: will I still (needlessly?) create two records, or will I just update the one record I already and split the range? Since the documentation is already talking about a feature specific to range and multirange types, it seems like this kind of stuff should be mentioned. Hmm. I guess this implies that we never do an update -- it's always a DELETE followed by zero, one, or two INSERTs. That seems like it's leaving quite a bit of efficiency on the table, because updating an existing row in place could potentially be a HOT update. Is this feature as per the SQL standard? And, assuming yes, does the SQL standard specify that permission checks should work as you describe here, or is that something we decided? -- Robert Haas EDB: http://www.enterprisedb.com
pgsql-hackers by date: