pgsql: Always use ReleaseTupleDesc after lookup_rowtype_tupdesc et al. - Mailing list pgsql-committers

From Tom Lane
Subject pgsql: Always use ReleaseTupleDesc after lookup_rowtype_tupdesc et al.
Date
Msg-id E1mxeAI-0007xD-Dp@gemulon.postgresql.org
Whole thread Raw
List 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(-)


pgsql-committers by date:

Previous
From: Tom Lane
Date:
Subject: pgsql: Remove pg_dump's --no-synchronized-snapshots switch.
Next
From: Thomas Munro
Date:
Subject: pgsql: Change ProcSendSignal() to take pgprocno.