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.98.2) (envelope-from ) id 1x886H-00000000vlN-0J6G for pgsql-committers@arkaria.postgresql.org; Sun, 20 Sep 2026 03:20:21 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.98.2) (envelope-from ) id 1x886F-00000005p5g-34gE for pgsql-committers@arkaria.postgresql.org; Sun, 20 Sep 2026 03:20:19 +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.98.2) (envelope-from ) id 1x886F-00000005p5Y-2Ces for pgsql-committers@lists.postgresql.org; Sun, 20 Sep 2026 03:20:19 +0000 Received: from sss.pgh.pa.us ([68.162.161.243]) by magus.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.98.2) (envelope-from ) id 1x886C-00000000IUh-3Nwh for pgsql-committers@lists.postgresql.org; Sun, 20 Sep 2026 03:20:19 +0000 Received: from sss1.sss.pgh.pa.us (localhost [127.0.0.1]) by sss.pgh.pa.us (8.18.1/8.18.1) with ESMTP id 68K3K8OE254196; Sat, 19 Sep 2026 23:20:08 -0400 From: Tom Lane To: Richard Guo cc: Alexander Lakhin , Amit Langote , pgsql-committers@lists.postgresql.org Subject: Re: pgsql: Invalidate RI fast-path metadata on operator family changes In-reply-to: References: Comments: In-reply-to Richard Guo message dated "Sun, 20 Sep 2026 09:43:31 +0900" MIME-Version: 1.0 Content-Type: text/plain; charset="UTF-8" Content-ID: <254194.1789874408.1@sss.pgh.pa.us> Content-Transfer-Encoding: quoted-printable Date: Sat, 19 Sep 2026 23:20:08 -0400 Message-ID: <254195.1789874408@sss.pgh.pa.us> List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk Richard Guo writes: > On Sun, Sep 20, 2026 at 3:00=E2=80=AFAM Alexander Lakhin wrote: >> I think the window failures are caused by these additions: >> +create operator family fam using btree; >> +create operator class int_ops for type integer using btree family fam = as >> + operator 1 <(integer,integer), operator 2 <=3D(integer,integer), >> + operator 3 =3D(integer,integer), operator 4 >=3D(integer,integer), >> + operator 5 >(integer,integer), function 1 btint4cmp(integer,integer)= ; > FWIW, this seems to also cause the equivclass failure on widowbird [1]. It's easy to show that this is indeed what is breaking the window.sql test cases: regression=3D# create temp table t1 (f1 int, f2 int8); insert into t1 values (1,1),(1,2),(2,2); CREATE TABLE INSERT 0 3 regression=3D# explain (costs off) select f1, sum(f1) over (partition by f1 order by f2 range between 1 preceding and 1 following) from t1 where f1 =3D f2; QUERY PLAN = = --------------------------------------------------------------------------= ----------------------------------- WindowAgg Window: w1 AS (PARTITION BY f1 ORDER BY f2 RANGE BETWEEN '1'::bigint PR= ECEDING AND '1'::bigint FOLLOWING) -> Sort Sort Key: f1 -> Seq Scan on t1 Filter: (f1 =3D f2) (6 rows) regression=3D# create operator family fam using btree; CREATE OPERATOR FAMILY regression=3D# create operator class int_ops for type integer using btree = family fam as regression-# operator 1 <(integer,integer), operator 2 <=3D(integer,integ= er), regression-# operator 3 =3D(integer,integer), operator 4 >=3D(integer,int= eger), regression-# operator 5 >(integer,integer), function 1 btint4cmp(integer,= integer); CREATE OPERATOR CLASS regression=3D# explain (costs off) select f1, sum(f1) over (partition by f1 order by f2 range between 1 preceding and 1 following) from t1 where f1 =3D f2; QUERY PLAN = = --------------------------------------------------------------------------= ----------------------------------- WindowAgg Window: w1 AS (PARTITION BY f1 ORDER BY f2 RANGE BETWEEN '1'::bigint PR= ECEDING AND '1'::bigint FOLLOWING) -> Sort Sort Key: f1, f1 -> Seq Scan on t1 Filter: (f1 =3D f2) (6 rows) Since t1 is a temp table, the common instability explanations like autovacuum don't hold water. I didn't look closely at why this FK test needs to have a broken operator class, but if it does, maybe you could put that whole test into a transaction that rolls back, so other sessions never see it. regards, tom lane