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 1wABcR-0029Ft-30 for pgsql-hackers@arkaria.postgresql.org; Tue, 07 Apr 2026 18:57:47 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.96) (envelope-from ) id 1wABcQ-001zpq-0b for pgsql-hackers@arkaria.postgresql.org; Tue, 07 Apr 2026 18:57:46 +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.96) (envelope-from ) id 1wABcP-001zph-2u for pgsql-hackers@lists.postgresql.org; Tue, 07 Apr 2026 18:57:46 +0000 Received: from sss.pgh.pa.us ([68.162.161.243]) by makus.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.98.2) (envelope-from ) id 1wABcO-000000015GT-0Uzj for pgsql-hackers@lists.postgresql.org; Tue, 07 Apr 2026 18:57:45 +0000 Received: from sss1.sss.pgh.pa.us (localhost [127.0.0.1]) by sss.pgh.pa.us (8.15.2/8.15.2) with ESMTP id 637IveUk2341924; Tue, 7 Apr 2026 14:57:40 -0400 From: Tom Lane To: Paul A Jungwirth cc: Kirill Reshke , jian he , PostgreSQL Hackers Subject: Re: domain for WITHOUT OVERLAPS In-reply-to: References: Comments: In-reply-to Paul A Jungwirth message dated "Tue, 10 Mar 2026 09:33:18 -0700" MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-ID: <2341922.1775588260.1@sss.pgh.pa.us> Date: Tue, 07 Apr 2026 14:57:40 -0400 Message-ID: <2341923.1775588260@sss.pgh.pa.us> List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk Paul A Jungwirth writes: > Thanks for taking a look! I changed places we say `-- not unique` to > now say `-- overlaps`. v5 is attached to my reply to jian he. I pushed this patch, but not without significant revisions: * I didn't think the case had been made for adding this field to typcache. There's only one user, it's in a very minority-interest code path, and it'd add both space in TypeCacheEntry and a noticeable number of cycles to TYPECACHE_DOMAIN_BASE_INFO requests. (Admittedly the extra-cycles complaint is weak, since we expect TypeCacheEntries to live a long time once populated.) The other problem was that the patch was buggy anyway: there is more than one place in typcache.c that'd have to change. I just moved the get_typtype(typcache->domainBaseType) call to runtime instead. We can revisit that if more potential uses appear. * I thought the number of new regression test cases was quite excessive compared to the value. On my machine, the runtime for without_overlaps.sql went from ~420ms to ~500ms, and it's already the slowest in its parallel group by a good margin. I cut it back to just testing the base domain-over-range and range-over-domain cases, which added only ~5ms. (To be clear, I think it was worth making those tests just to verify there are no other holes. But carrying them forward forevermore is another matter.) * I happened to notice that the loop just above the changes in transformIndexConstraint was buggy: it had "break" where it should have had "continue". That bug can be demonstrated with CREATE TABLE temporal_rng4 ( id int4range, bogus int, valid_at int4 ); ALTER TABLE temporal_rng4 DROP COLUMN bogus; ALTER TABLE temporal_rng4 ADD CONSTRAINT temporal_rng4_pk UNIQUE (id, valid_at WITHOUT OVERLAPS); which gave different errors with and without the DROP COLUMN step. regards, tom lane