pgsql: Always use ReleaseTupleDesc after lookup_rowtype_tupdesc et al.

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: pgsql-committers(at)lists(dot)postgresql(dot)org
Subject: pgsql: Always use ReleaseTupleDesc after lookup_rowtype_tupdesc et al.
Date: 2021-12-15 23:58:30
Message-ID: E1mxeAI-0007xD-Dp@gemulon.postgresql.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-committers

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(-)

Browse pgsql-committers by date

  From Date Subject
Next Message Thomas Munro 2021-12-16 02:59:47 pgsql: Change ProcSendSignal() to take pgprocno.
Previous Message Tom Lane 2021-12-15 23:45:32 pgsql: Remove pg_dump's --no-synchronized-snapshots switch.