aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/backend/commands/tablecmds.c2
-rw-r--r--src/backend/executor/execExpr.c2
-rw-r--r--src/backend/parser/parse_utilcmd.c2
-rw-r--r--src/backend/utils/adt/expandedrecord.c4
-rw-r--r--src/backend/utils/cache/typcache.c7
5 files changed, 10 insertions, 7 deletions
diff --git a/src/backend/commands/tablecmds.c b/src/backend/commands/tablecmds.c
index 47b29001d5c..bf42587e383 100644
--- a/src/backend/commands/tablecmds.c
+++ b/src/backend/commands/tablecmds.c
@@ -15401,7 +15401,7 @@ ATExecAddOf(Relation rel, const TypeName *ofTypename, LOCKMODE lockmode)
errmsg("table \"%s\" has different type for column \"%s\"",
RelationGetRelationName(rel), type_attname)));
}
- DecrTupleDescRefCount(typeTupleDesc);
+ ReleaseTupleDesc(typeTupleDesc);
/* Any remaining columns at the end of the table had better be dropped. */
for (; table_attno <= tableTupleDesc->natts; table_attno++)
diff --git a/src/backend/executor/execExpr.c b/src/backend/executor/execExpr.c
index 892b4e17e09..7d343f06787 100644
--- a/src/backend/executor/execExpr.c
+++ b/src/backend/executor/execExpr.c
@@ -1465,7 +1465,7 @@ ExecInitExprRec(Expr *node, ExprState *state,
/* find out the number of columns in the composite type */
tupDesc = lookup_rowtype_tupdesc(fstore->resulttype, -1);
ncolumns = tupDesc->natts;
- DecrTupleDescRefCount(tupDesc);
+ ReleaseTupleDesc(tupDesc);
/* create workspace for column values */
values = (Datum *) palloc(sizeof(Datum) * ncolumns);
diff --git a/src/backend/parser/parse_utilcmd.c b/src/backend/parser/parse_utilcmd.c
index 313d7b6ff02..2d857a301bb 100644
--- a/src/backend/parser/parse_utilcmd.c
+++ b/src/backend/parser/parse_utilcmd.c
@@ -1484,7 +1484,7 @@ transformOfType(CreateStmtContext *cxt, TypeName *ofTypename)
n->location = -1;
cxt->columns = lappend(cxt->columns, n);
}
- DecrTupleDescRefCount(tupdesc);
+ ReleaseTupleDesc(tupdesc);
ReleaseSysCache(tuple);
}
diff --git a/src/backend/utils/adt/expandedrecord.c b/src/backend/utils/adt/expandedrecord.c
index e19491ecf74..38d5384c00e 100644
--- a/src/backend/utils/adt/expandedrecord.c
+++ b/src/backend/utils/adt/expandedrecord.c
@@ -171,7 +171,7 @@ make_expanded_record_from_typeid(Oid type_id, int32 typmod,
/* If we called lookup_rowtype_tupdesc, release the pin it took */
if (type_id == RECORDOID)
- DecrTupleDescRefCount(tupdesc);
+ ReleaseTupleDesc(tupdesc);
}
else
{
@@ -854,7 +854,7 @@ expanded_record_fetch_tupdesc(ExpandedRecordHeader *erh)
tupdesc->tdrefcount++;
/* Release the pin lookup_rowtype_tupdesc acquired */
- DecrTupleDescRefCount(tupdesc);
+ ReleaseTupleDesc(tupdesc);
}
else
{
diff --git a/src/backend/utils/cache/typcache.c b/src/backend/utils/cache/typcache.c
index 70e5c51297d..d140ef66552 100644
--- a/src/backend/utils/cache/typcache.c
+++ b/src/backend/utils/cache/typcache.c
@@ -1820,8 +1820,11 @@ lookup_rowtype_tupdesc_internal(Oid type_id, int32 typmod, bool noError)
* for example from record_in().)
*
* Note: on success, we increment the refcount of the returned TupleDesc,
- * and log the reference in CurrentResourceOwner. Caller should call
- * ReleaseTupleDesc or DecrTupleDescRefCount when done using the tupdesc.
+ * and log the reference in CurrentResourceOwner. Caller must call
+ * ReleaseTupleDesc when done using the tupdesc. (There are some
+ * cases in which the returned tupdesc is not refcounted, in which
+ * case PinTupleDesc/ReleaseTupleDesc are no-ops; but in these cases
+ * the tupdesc is guaranteed to live till process exit.)
*/
TupleDesc
lookup_rowtype_tupdesc(Oid type_id, int32 typmod)