pg.ddx.io  pgsql-committers@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Tom Lane <tgl@sss.pgh.pa.us>
To: pgsql-committers@lists.postgresql.org
Subject: pgsql: Always use ReleaseTupleDesc after lookup_rowtype_tupdesc et al.
Date: Wed, 15 Dec 2021 23:58:30 +0000
Message-ID: <E1mxeAI-0007xD-Dp@gemulon.postgresql.org> (raw)

Always use ReleaseTupleDesc after lookup_rowtype_tupdesc et al.

The API spec for lookup_rowtype_tupdesc previously said you could use
either ReleaseTupleDesc or DecrTupleDescRefCount.  However, the latter
choice means the caller must be certain that the returned tupdesc is
refcounted.  I don't recall right now whether that was always true
when this spec was written, but it's certainly not always true since
we introduced shared record typcaches for parallel workers.  That means
that callers using DecrTupleDescRefCount are dependent on typcache
behavior details that they probably shouldn't be.  Hence, change the API
spec to say that you must call ReleaseTupleDesc, and fix the half-dozen
callers that weren't.

AFAICT this is just future-proofing, there's no live bug here.
So no back-patch.

Per gripe from Chapman Flack.

Discussion: https://postgr.es/m/61B901A4.1050808@anastigmatix.net

Branch
------
master

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

Modified Files
--------------
src/backend/commands/tablecmds.c       | 2 +-
src/backend/executor/execExpr.c        | 2 +-
src/backend/parser/parse_utilcmd.c     | 2 +-
src/backend/utils/adt/expandedrecord.c | 4 ++--
src/backend/utils/cache/typcache.c     | 7 +++++--
5 files changed, 10 insertions(+), 7 deletions(-)



Message-ID: <E1mxeAI-0007xD-Dp@gemulon.postgresql.org>
Permalink:  ../E1mxeAI-0007xD-Dp@gemulon.postgresql.org/
Also on:    postgresql.org/message-id/E1mxeAI-0007xD-Dp@gemulon.postgresql.org

 · 

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 from your mail client; the link fills in
  the headers below: reply via email
  Some clients, webmail especially, drop In-Reply-To and References from
  a link, and the reply then starts a new thread: use the mbox below.

  To: pgsql-committers@postgresql.org
  Cc: tgl@sss.pgh.pa.us
  Subject: Re: pgsql: Always use ReleaseTupleDesc after lookup_rowtype_tupdesc et al.
  In-Reply-To: <E1mxeAI-0007xD-Dp@gemulon.postgresql.org>
  References: <E1mxeAI-0007xD-Dp@gemulon.postgresql.org>

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

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