Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1uDSnW-00BAJR-U0 for pgsql-hackers@arkaria.postgresql.org; Fri, 09 May 2025 18:50:15 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.94.2) (envelope-from ) id 1uDSnV-00DdKA-IP for pgsql-hackers@arkaria.postgresql.org; Fri, 09 May 2025 18:50:13 +0000 Received: from makus.postgresql.org ([2001:4800:3e1:1::229]) by malur.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1uDSnV-00DdJk-7n for pgsql-hackers@lists.postgresql.org; Fri, 09 May 2025 18:50:13 +0000 Received: from mail-ej1-x633.google.com ([2a00:1450:4864:20::633]) by makus.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256 (Exim 4.96) (envelope-from ) id 1uDSnS-000zwL-23 for pgsql-hackers@lists.postgresql.org; Fri, 09 May 2025 18:50:12 +0000 Received: by mail-ej1-x633.google.com with SMTP id a640c23a62f3a-ad1a87d93f7so423104566b.0 for ; Fri, 09 May 2025 11:50:11 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1746816609; x=1747421409; darn=lists.postgresql.org; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:from:to:cc:subject:date :message-id:reply-to; bh=4xYfu4Do/hUrSzCP6hlQkidum6Yks9vsKOe23cXd6k0=; b=PLr7JRlgE4op0LEtB4TYiyGbgmifGJdBoEpWN3zyxr7jJ3vhV9DCLXP80HhczHZjPE GSB4bl7oTsk+rKUL5HOA5MqOKS4u6r/5HXYBzYH/eXj3eHfQK04SPvjAUj4zzAW/GD/Z GHvtO6Xr0oNosYYI9bfsF60L545OOQQmUkaoV7qfnT78HnjPzRFe7Fj/V6mqiypdt3j5 +QJghivHKqJW2fd4gKrBghcqjJfztnVGU+bAl0zd3V7Z/qVBQjK/nixZbXUsoSB7rBvY KPsvfzOXqQ+qc7zXKYaYh5Bmcnrw4f/OlORemXcrs7VhDqskou7XVZeryUEyz0XxPjbt VCZQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1746816609; x=1747421409; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=4xYfu4Do/hUrSzCP6hlQkidum6Yks9vsKOe23cXd6k0=; b=PgMDG3127pPz7bKrBZUhvFQb5eCcVxHajm/OEnX5cYl7IUqmBddWzhGWPgj9vNsZkT rhQjXAszli6eDYQRh+HDOp5+IEXgAMv6jmS9I6R800mv/hkrEmskG4aLC7Yka7j2auhh 3GxjPdLCuT8MUslA8fa2kXYtBHVuFiEaWt2jCku17iyjgeFXONPu6TXZYQ5POWItYzMo GaVKsihocI1yXumElK1OhXs8+5pumDFAOIJt7GZwlR2HsjEAfYqD4iaM9ODkEyCoIpSR dtCxM1fX7g5AHUf2+hCF6qDHTD30v0bJfVhGuXXslpeI5JulLr3s+sGDXObcGy57rWP2 mo/g== X-Forwarded-Encrypted: i=1; AJvYcCVyQrfGVc+Fd0eG0i2F98f3RURletU0ZacVGThqNMy46qG5qpM4peZ1YgsVVL9btME6jEkHkiGyU4Sx5+oU@lists.postgresql.org X-Gm-Message-State: AOJu0YznJCxQ4l9gqk2H6rZIqybIBA8WgLAD1EdWe8x1qEr/09S8MZSs QxMGcTih26bBfeHEZd15bFcHkLfEfpaaiDghGzGS5G4UFlTiDShMqZVW0FhGZOxGLvb09luFGFN xtnwaOM+5MKNYurCPX5Oy2FcOjCP61Wax X-Gm-Gg: ASbGncs7RUBCQQgRtj9tVhe7JqXNyqIL3yhRYxfQuFUj2YWFfmDf44E3CxkXxuprpQr Djc5Ph5y7rUuUSajd1lAhKRtPR4kpqqOiEhi91Fu8aYCUXQCEKGON90hpnA4ZjEmygGHPy0oZU2 CZdOjlLmVUgtqXf0BZG0PHlj1plm8TyTR1 X-Google-Smtp-Source: AGHT+IGqlh54cjT5Vm1tTFfjLnM+VOtbbcO+drKBAILKlSeImSzZlzys4WYCfkCZIHXcxGN1NuL7GyhogGHZM0FO10U= X-Received: by 2002:a17:906:7c55:b0:ad2:28be:9a0d with SMTP id a640c23a62f3a-ad228be9beemr184423866b.52.1746816608651; Fri, 09 May 2025 11:50:08 -0700 (PDT) MIME-Version: 1.0 References: <333d3886-b737-45c3-93f4-594c96bb405d@eisentraut.org> <6a2247d9-461d-4b0a-b692-f0f3c0fab27f@eisentraut.org> <8f995a4c-64e3-40cd-bfed-06b54a280d36@illuminatedcomputing.com> <0832f18d-523f-4c15-acb0-338a785150c5@illuminatedcomputing.com> <5f0c25de-2c13-4fb5-a4df-a1e03c43cd14@illuminatedcomputing.com> <1b45f81d-4e99-4813-a2c6-72bf5fd80980@eisentraut.org> <3e061027-781d-42c1-b6e8-bafbf3b51033@eisentraut.org> <3b33690e-0d67-47a5-8424-93ac1fed4c26@eisentraut.org> <1085d8a3-17a7-4639-afd2-bd6dfa09713d@illuminatedcomputing.com> <6ac43c8e-5595-40d9-a039-ede12e7487e1@eisentraut.org> <34f9c43a-bad0-482a-a563-a3c202a2b678@illuminatedcomputing.com> In-Reply-To: From: Robert Haas Date: Fri, 9 May 2025 14:49:57 -0400 X-Gm-Features: ATxdqUF3AVim3DfOoLXHpl-RehyHEps3HBkNHclrVULW-jl3ELUEKs4Wyskib1Q Message-ID: Subject: Re: SQL:2011 application time To: Paul A Jungwirth Cc: Peter Eisentraut , jian he , PostgreSQL Hackers , vignesh C Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk On Thu, May 8, 2025 at 1:36=E2=80=AFPM Paul A Jungwirth 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 or 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