pgsql: Use relation_close() more consistently in contrib/

From: Michael Paquier <michael(at)paquier(dot)xyz>
To: pgsql-committers(at)lists(dot)postgresql(dot)org
Subject: pgsql: Use relation_close() more consistently in contrib/
Date: 2026-01-06 07:29:16
Message-ID: E1vd1VD-004oCH-1T@gemulon.postgresql.org
Views: Whole Thread | Raw Message | Download mbox | Resend email
Thread:
Lists: pgsql-committers

Use relation_close() more consistently in contrib/

All the code paths updated here have been using index_close() to
close a relation that was opened with relation_open(), in pgstattuple
and pageinspect. index_close() does the same thing as relation_close(),
so there is no harm, but being inconsistent could lead to issues if the
internals of these close() functions begin to introduce some specific
logic in the future.

In passing, this commit adds some comments explaining why we are using
relation_open() instead of index_open() in a few places, which is due to
the fact that partitioned indexes are not allowed in these functions.

Author: Bertrand Drouvot <bertranddrouvot(dot)pg(at)gmail(dot)com>
Reviewed-by: Chao Li <li(dot)evan(dot)chao(at)gmail(dot)com>
Reviewed-by: Japin Li <japinli(at)hotmail(dot)com>
Discussion: https://postgr.es/m/aUKamYGiDKO6byp5@ip-10-97-1-34.eu-west-3.compute.internal

Branch
------
master

Details
-------
https://git.postgresql.org/pg/commitdiff/8b9b93e39b10ce32577eca3c84face880fc8aff0

Modified Files
--------------
contrib/pageinspect/hashfuncs.c | 6 +++++-
contrib/pgstattuple/pgstatindex.c | 10 +++++++++-
2 files changed, 14 insertions(+), 2 deletions(-)

Browse pgsql-committers by date

  From Date Subject
Next Message Alexander Korotkov 2026-01-06 08:04:35 pgsql: Fix variable usage in wakeupWaiters()
Previous Message Michael Paquier 2026-01-06 05:24:41 pgsql: Allow bgworkers to be terminated for database-related commands