Don't know if you noticed yet, but avocet has shown [1] that one
pg_plan_advice test case is unstable under debug_discard_caches = 1:

diff -U3 
/home/buildfarm/avocet/buildroot/HEAD/pgsql.build/contrib/pg_plan_advice/expected/prepared.out
 
/home/buildfarm/avocet/buildroot/HEAD/pgsql.build/contrib/pg_plan_advice/results/prepared.out
--- 
/home/buildfarm/avocet/buildroot/HEAD/pgsql.build/contrib/pg_plan_advice/expected/prepared.out
      2026-03-16 11:04:23.453026641 +0100
+++ 
/home/buildfarm/avocet/buildroot/HEAD/pgsql.build/contrib/pg_plan_advice/results/prepared.out
       2026-03-17 20:42:16.262657929 +0100
@@ -57,11 +57,13 @@
 -- Prepared, but always_store_advice_details = true, so should show feedback.
 PREPARE pt4 AS SELECT * FROM ptab;
 EXPLAIN (COSTS OFF, PLAN_ADVICE) EXECUTE pt2;
-       QUERY PLAN       
-------------------------
+           QUERY PLAN           
+--------------------------------
  Seq Scan on ptab
+ Supplied Plan Advice:
+   SEQ_SCAN(ptab) /* matched */
  Generated Plan Advice:
    SEQ_SCAN(ptab)
    NO_GATHER(ptab)
-(4 rows)
+(6 rows)

I can reproduce this pretty trivially by adding
SET debug_discard_caches = 1;
at the top of contrib/pg_plan_advice/sql/prepared.sql.

It looks like the appearance of "Supplied Plan Advice:" depends
on whether the prepared query's plan got regenerated or not.
I'm not sure if this represents a bug (ie undesirable behavior) or
it's just that the test is being insufficiently careful about
being reproducible.

                        regards, tom lane

[1] 
https://buildfarm.postgresql.org/cgi-bin/show_log.pl?nm=avocet&dt=2026-03-16%2010%3A03%3A01


Reply via email to