agora inbox for pgsql-committers@postgresql.org  
help / color / mirror / Atom feed
From: Tom Lane <tgl@sss.pgh.pa.us>
To: Richard Guo <guofenglinux@gmail.com>
Cc: Alexander Lakhin <exclusion@gmail.com>
Cc: Amit Langote <amitlangote09@gmail.com>
Cc: pgsql-committers@lists.postgresql.org
Subject: Re: pgsql: Invalidate RI fast-path metadata on operator family changes
Date: Sat, 19 Sep 2026 23:20:08 -0400
Message-ID: <254195.1789874408@sss.pgh.pa.us> (raw)
In-Reply-To: <CAMbWs49M_=7ya47-1McJSyW4Bf4haT5EAHq8263znRxOWZ=t5Q@mail.gmail.com>
References: <E1x7p34-00000000Mv7-2O5S@gemulon.postgresql.org>
	<CA+HiwqGitHCmO7nvV4nXXYWDkNYA+zVcJj=JNmL3C1O9B0Gz0A@mail.gmail.com>
	<CA+HiwqHO2xu3eR6bZ99qSQgCTnoS9VC4e0KW25bxE5kmkRMGyQ@mail.gmail.com>
	<e0258f8a-b8f5-411b-963f-5499afe78bf2@gmail.com>
	<CAMbWs49M_=7ya47-1McJSyW4Bf4haT5EAHq8263znRxOWZ=t5Q@mail.gmail.com>

Richard Guo <guofenglinux@gmail.com> writes:
> On Sun, Sep 20, 2026 at 3:00 AM Alexander Lakhin <exclusion@gmail.com> 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 <=(integer,integer),
>> +  operator 3 =(integer,integer), operator 4 >=(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=# create temp table t1 (f1 int, f2 int8);
insert into t1 values (1,1),(1,2),(2,2);
CREATE TABLE
INSERT 0 3
regression=# 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 = f2;
                                                 QUERY PLAN                                                  
-------------------------------------------------------------------------------------------------------------
 WindowAgg
   Window: w1 AS (PARTITION BY f1 ORDER BY f2 RANGE BETWEEN '1'::bigint PRECEDING AND '1'::bigint FOLLOWING)
   ->  Sort
         Sort Key: f1
         ->  Seq Scan on t1
               Filter: (f1 = f2)
(6 rows)

regression=# create operator family fam using btree;
CREATE OPERATOR FAMILY
regression=# create operator class int_ops for type integer using btree family fam as
regression-#  operator 1 <(integer,integer), operator 2 <=(integer,integer),
regression-#  operator 3 =(integer,integer), operator 4 >=(integer,integer),
regression-#  operator 5 >(integer,integer), function 1 btint4cmp(integer,integer);
CREATE OPERATOR CLASS
regression=# 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 = f2;
                                                 QUERY PLAN                                                  
-------------------------------------------------------------------------------------------------------------
 WindowAgg
   Window: w1 AS (PARTITION BY f1 ORDER BY f2 RANGE BETWEEN '1'::bigint PRECEDING AND '1'::bigint FOLLOWING)
   ->  Sort
         Sort Key: f1, f1
         ->  Seq Scan on t1
               Filter: (f1 = 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





view thread (13+ messages)  latest in thread

Message-ID: <254195.1789874408@sss.pgh.pa.us>
Permalink:  ../254195.1789874408@sss.pgh.pa.us/
Also on:    postgresql.org/message-id/254195.1789874408@sss.pgh.pa.us

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients using the --to and --cc options:
  reply via email

  To: pgsql-committers@postgresql.org
  Cc: tgl@sss.pgh.pa.us, guofenglinux@gmail.com, exclusion@gmail.com, amitlangote09@gmail.com, pgsql-committers@lists.postgresql.org
  Subject: Re: pgsql: Invalidate RI fast-path metadata on operator family changes
  In-Reply-To: <254195.1789874408@sss.pgh.pa.us>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by agora; see mirroring instructions
for how to clone and mirror all data and code used for this inbox