pgsql: Fix missed ReleaseVariableStats() in intarray's _int_matchsel().

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: pgsql-committers(at)lists(dot)postgresql(dot)org
Subject: pgsql: Fix missed ReleaseVariableStats() in intarray's _int_matchsel().
Date: 2026-05-25 22:16:02
Message-ID: E1wRdac-001726-0Y@gemulon.postgresql.org
Views: Whole Thread | Raw Message | Download mbox | Resend email
Thread:
Lists: pgsql-committers

Fix missed ReleaseVariableStats() in intarray's _int_matchsel().

Given a WHERE clause like "int[] @@ query_int" or "query_int ~~ int[]"
where the query_int side is a table column having statistics,
_int_matchsel() exited without remembering to free the statistics
tuple. This would typically lead to warnings about cache refcount
leakage, like
WARNING: resource was not closed: cache pg_statistic (73), tuple 42/12 has count 1
It's been wrong since this code was added, in commit c6fbe6d6f.

Bug: #19492
Reported-by: Man Zeng <zengman(at)halodbtech(dot)com>
Author: Man Zeng <zengman(at)halodbtech(dot)com>
Reviewed-by: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Discussion: https://postgr.es/m/19492-ddcd0e22399ef85a@postgresql.org
Backpatch-through: 14

Branch
------
REL_18_STABLE

Details
-------
https://git.postgresql.org/pg/commitdiff/e7544c518ab0943fc85e2a4b44df9f7561ad2d0c

Modified Files
--------------
contrib/intarray/_int_selfuncs.c | 3 +++
1 file changed, 3 insertions(+)

Browse pgsql-committers by date

  From Date Subject
Next Message Michael Paquier 2026-05-25 23:26:14 pgsql: Adjust some error hints
Previous Message Fujii Masao 2026-05-25 16:09:42 pgsql: dblink: Reject use_scram_passthrough on foreign-data wrappers