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.96) (envelope-from ) id 1vJ5Uh-00A7FP-1k for pgsql-hackers@arkaria.postgresql.org; Wed, 12 Nov 2025 07:42:18 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.96) (envelope-from ) id 1vJ5Uf-009qp8-0w for pgsql-hackers@arkaria.postgresql.org; Wed, 12 Nov 2025 07:42:17 +0000 Received: from magus.postgresql.org ([2a02:c0:301:0:ffff::29]) by malur.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.96) (envelope-from ) id 1vJ5Ue-009qoz-12 for pgsql-hackers@lists.postgresql.org; Wed, 12 Nov 2025 07:42:16 +0000 Received: from fout-b5-smtp.messagingengine.com ([202.12.124.148]) by magus.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.96) (envelope-from ) id 1vJ5Ub-007IVj-0B for pgsql-hackers@lists.postgresql.org; Wed, 12 Nov 2025 07:42:16 +0000 Received: from phl-compute-05.internal (phl-compute-05.internal [10.202.2.45]) by mailfout.stl.internal (Postfix) with ESMTP id 4FE921D00171; Wed, 12 Nov 2025 02:42:10 -0500 (EST) Received: from phl-mailfrontend-01 ([10.202.2.162]) by phl-compute-05.internal (MEProxy); Wed, 12 Nov 2025 02:42:10 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=eisentraut.org; h=cc:cc:content-transfer-encoding:content-type:content-type :date:date:from:from:in-reply-to:in-reply-to:message-id :mime-version:references:reply-to:subject:subject:to:to; s=fm2; t=1762933330; x=1763019730; bh=fP8tYovod82BH0KFI5inSXEfiKkQvBdM RF68IBwdRe8=; b=FVcRpoJQeJdwjaSfgNRQtQpktwIbFb1z2iy1AVTsdblGYhm/ XthAgiL3LJEbNmi9FeBoOvNysXRaGQPUENQsJCWki15Oxv3nLSjmXCG8PTCIZCvi /6jFedW51StsdcB3fQrRg3bAY0b76s0f2FHyJ3ddn3WyLMZC49DJ1b2fC2K95zcr H7Cum7AtfJ10isty+Nt5LT9GzC7CX5zFtbhCL/Zltse7Tv/hmwf2DEz2cLMMjD6I 0QhBzX/B9gXSVUy0cdY/O9Xh4j232p2udhDxNNRj4hW5uWdRNnSeD9q7aPdrYsOP 7WPzEnedgKx4RIFDWCaOrZRegLB6KnvjVK/Pug== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:cc:content-transfer-encoding :content-type:content-type:date:date:feedback-id:feedback-id :from:from:in-reply-to:in-reply-to:message-id:mime-version :references:reply-to:subject:subject:to:to:x-me-proxy :x-me-sender:x-me-sender:x-sasl-enc; s=fm3; t=1762933330; x= 1763019730; bh=fP8tYovod82BH0KFI5inSXEfiKkQvBdMRF68IBwdRe8=; b=0 dE/7j5s3pDIG/vFpOt/KPvnNlTLBZwOrtmM5NkcpHIcNFhweoMnO+IBxbGbOZ+qI V7H4ga+2tAn1xoZjQNWhVvVmCj2zQO0QJCTNEB69ZO9YOLz5dHUhj4bWP1KlT9ba 2TuT2y+J544FZOKgGpwM5y4ri2PWQsethxZgoDytPFY6JuJtxQKiRlU0zYc4JcPd QxLKOd6OzDBBhM3zo7bacd8+X3qvL5mAU6gPA0BmoHI/MesZu2H6xLLKWO5Iq0hX 2QQNTz9eXeQ4isxdqb742XCVv20GILaJtGNU5dREDQqD27SMFQF1QOTAeslrdIWS +xIr/9MDgU/MEQVdZ24zA== X-ME-Sender: X-ME-Received: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgeeffedrtdeggddvtdefhedtucetufdoteggodetrf dotffvucfrrhhofhhilhgvmecuhfgrshhtofgrihhlpdfurfetoffkrfgpnffqhgenuceu rghilhhouhhtmecufedttdenucesvcftvggtihhpihgvnhhtshculddquddttddmnecujf gurhepkfffgggfuffvvehfhfgjtgfgsehtjeertddtvdejnecuhfhrohhmpefrvghtvghr ucfgihhsvghnthhrrghuthcuoehpvghtvghrsegvihhsvghnthhrrghuthdrohhrgheqne cuggftrfgrthhtvghrnhepgfejtdfhkeeftdeugfeileehteeljeeghfeuledthfeutedv ffdukeefjefhgeehnecuvehluhhsthgvrhfuihiivgeptdenucfrrghrrghmpehmrghilh hfrhhomhepphgvthgvrhesvghishgvnhhtrhgruhhtrdhorhhgpdhnsggprhgtphhtthho pedvpdhmohguvgepshhmthhpohhuthdprhgtphhtthhopehpjhesihhllhhumhhinhgrth gvuggtohhmphhuthhinhhgrdgtohhmpdhrtghpthhtohepphhgshhqlhdqhhgrtghkvghr sheslhhishhtshdrphhoshhtghhrvghsqhhlrdhorhhg X-ME-Proxy: Feedback-ID: ie0a040ee:Fastmail Received: by mail.messagingengine.com (Postfix) with ESMTPA; Wed, 12 Nov 2025 02:42:09 -0500 (EST) Message-ID: <1ace7bc1-9dd4-42c9-a473-517cef37cce9@eisentraut.org> Date: Wed, 12 Nov 2025 08:42:07 +0100 MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Subject: Re: SQL:2011 Application Time Update & Delete To: Paul A Jungwirth Cc: PostgreSQL Hackers References: <2f5364f3-a1d3-4410-98f3-d788b11e6525@eisentraut.org> Content-Language: en-US From: Peter Eisentraut In-Reply-To: Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk I have looked at the patch v59-0004-Add-range_minus_multi-and-multirange_minus_multi.patch This seems sound in principle. Perhaps you could restate why you chose a set-returning function rather than (what I suppose would be the other options) returning multirange or an array of ranges. (I don't necessarily disagree, but it would be good to be clear for everyone.) The point about allowing user-defined types makes sense (but for example, I see types like multipolygon and multipoint in postgis, so maybe those could also work?). That said, I think there is a problem in your implementation. Note that the added regression test cases for range return multiple rows but the ones for multirange all return a single row with a set {....} value. I think the problem is that your multirange_minus_multi() calls multirange_minus_internal() which already returns a set, and you are packing that set result into a single row. A few other minor details: * src/backend/utils/adt/rangetypes.c +#include "utils/array.h" seems to be unused. + typedef struct + { + RangeType *rs[2]; + int n; + } range_minus_multi_fctx; This could be written just as a struct, like struct range_minus_multi_fctx { ... }; Wrapping it in a typedef doesn't achieve any additional useful abstraction. The code comment before range_minus_multi_internal() could first explain briefly what the function does before going into the details of the arguments. Because we can't assume that someone will have read the descriptions of the higher-level functions first. * src/include/catalog/pg_proc.dat The prorows values for the two new functions should be the same? (I suppose they are correct now seeing your implementation of multirange_minus_multi(), but I'm not sure that was intended, as discussed above.)