mirror of
https://github.com/postgres/postgres.git
synced 2025-07-09 22:41:56 +03:00
Replace uses of heap_open et al with the corresponding table_* function.
Author: Andres Freund Discussion: https://postgr.es/m/20190111000539.xbv7s6w7ilcvm7dp@alap3.anarazel.de
This commit is contained in:
@ -201,13 +201,13 @@ setTargetTable(ParseState *pstate, RangeVar *relation,
|
||||
|
||||
/* Close old target; this could only happen for multi-action rules */
|
||||
if (pstate->p_target_relation != NULL)
|
||||
heap_close(pstate->p_target_relation, NoLock);
|
||||
table_close(pstate->p_target_relation, NoLock);
|
||||
|
||||
/*
|
||||
* Open target rel and grab suitable lock (which we will hold till end of
|
||||
* transaction).
|
||||
*
|
||||
* free_parsestate() will eventually do the corresponding heap_close(),
|
||||
* free_parsestate() will eventually do the corresponding table_close(),
|
||||
* but *not* release the lock.
|
||||
*/
|
||||
pstate->p_target_relation = parserOpenTable(pstate, relation,
|
||||
|
@ -88,7 +88,7 @@ free_parsestate(ParseState *pstate)
|
||||
MaxTupleAttributeNumber)));
|
||||
|
||||
if (pstate->p_target_relation != NULL)
|
||||
heap_close(pstate->p_target_relation, NoLock);
|
||||
table_close(pstate->p_target_relation, NoLock);
|
||||
|
||||
pfree(pstate);
|
||||
}
|
||||
|
@ -1137,7 +1137,7 @@ chooseScalarFunctionAlias(Node *funcexpr, char *funcname,
|
||||
/*
|
||||
* Open a table during parse analysis
|
||||
*
|
||||
* This is essentially just the same as heap_openrv(), except that it caters
|
||||
* This is essentially just the same as table_openrv(), except that it caters
|
||||
* to some parser-specific error reporting needs, notably that it arranges
|
||||
* to include the RangeVar's parse location in any resulting error.
|
||||
*
|
||||
@ -1152,7 +1152,7 @@ parserOpenTable(ParseState *pstate, const RangeVar *relation, int lockmode)
|
||||
ParseCallbackState pcbstate;
|
||||
|
||||
setup_parser_errposition_callback(&pcbstate, pstate, relation->location);
|
||||
rel = heap_openrv_extended(relation, lockmode, true);
|
||||
rel = table_openrv_extended(relation, lockmode, true);
|
||||
if (rel == NULL)
|
||||
{
|
||||
if (relation->schemaname)
|
||||
@ -1240,7 +1240,7 @@ addRangeTableEntry(ParseState *pstate,
|
||||
* so that the table can't be deleted or have its schema modified
|
||||
* underneath us.
|
||||
*/
|
||||
heap_close(rel, NoLock);
|
||||
table_close(rel, NoLock);
|
||||
|
||||
/*
|
||||
* Set flags and access permissions.
|
||||
@ -3096,7 +3096,7 @@ get_parse_rowmark(Query *qry, Index rtindex)
|
||||
* Returns InvalidAttrNumber if the attr doesn't exist (or is dropped).
|
||||
*
|
||||
* This should only be used if the relation is already
|
||||
* heap_open()'ed. Use the cache version get_attnum()
|
||||
* table_open()'ed. Use the cache version get_attnum()
|
||||
* for access to non-opened relations.
|
||||
*/
|
||||
int
|
||||
@ -3146,7 +3146,7 @@ specialAttNum(const char *attname)
|
||||
* given attribute id, return name of that attribute
|
||||
*
|
||||
* This should only be used if the relation is already
|
||||
* heap_open()'ed. Use the cache version get_atttype()
|
||||
* table_open()'ed. Use the cache version get_atttype()
|
||||
* for access to non-opened relations.
|
||||
*/
|
||||
const NameData *
|
||||
@ -3168,7 +3168,7 @@ attnumAttName(Relation rd, int attid)
|
||||
* given attribute id, return type of that attribute
|
||||
*
|
||||
* This should only be used if the relation is already
|
||||
* heap_open()'ed. Use the cache version get_atttype()
|
||||
* table_open()'ed. Use the cache version get_atttype()
|
||||
* for access to non-opened relations.
|
||||
*/
|
||||
Oid
|
||||
@ -3189,7 +3189,7 @@ attnumTypeId(Relation rd, int attid)
|
||||
/*
|
||||
* given attribute id, return collation of that attribute
|
||||
*
|
||||
* This should only be used if the relation is already heap_open()'ed.
|
||||
* This should only be used if the relation is already table_open()'ed.
|
||||
*/
|
||||
Oid
|
||||
attnumCollationId(Relation rd, int attid)
|
||||
@ -3361,10 +3361,10 @@ isQueryUsingTempRelation_walker(Node *node, void *context)
|
||||
|
||||
if (rte->rtekind == RTE_RELATION)
|
||||
{
|
||||
Relation rel = heap_open(rte->relid, AccessShareLock);
|
||||
Relation rel = table_open(rte->relid, AccessShareLock);
|
||||
char relpersistence = rel->rd_rel->relpersistence;
|
||||
|
||||
heap_close(rel, AccessShareLock);
|
||||
table_close(rel, AccessShareLock);
|
||||
if (relpersistence == RELPERSISTENCE_TEMP)
|
||||
return true;
|
||||
}
|
||||
|
@ -1200,7 +1200,7 @@ transformTableLikeClause(CreateStmtContext *cxt, TableLikeClause *table_like_cla
|
||||
* commit. That will prevent someone else from deleting or ALTERing the
|
||||
* parent before the child is committed.
|
||||
*/
|
||||
heap_close(relation, NoLock);
|
||||
table_close(relation, NoLock);
|
||||
}
|
||||
|
||||
static void
|
||||
@ -2157,7 +2157,7 @@ transformIndexConstraint(Constraint *constraint, CreateStmtContext *cxt)
|
||||
Relation rel;
|
||||
int count;
|
||||
|
||||
rel = heap_openrv(inh, AccessShareLock);
|
||||
rel = table_openrv(inh, AccessShareLock);
|
||||
/* check user requested inheritance from valid relkind */
|
||||
if (rel->rd_rel->relkind != RELKIND_RELATION &&
|
||||
rel->rd_rel->relkind != RELKIND_FOREIGN_TABLE &&
|
||||
@ -2187,7 +2187,7 @@ transformIndexConstraint(Constraint *constraint, CreateStmtContext *cxt)
|
||||
break;
|
||||
}
|
||||
}
|
||||
heap_close(rel, NoLock);
|
||||
table_close(rel, NoLock);
|
||||
if (found)
|
||||
break;
|
||||
}
|
||||
@ -2280,7 +2280,7 @@ transformIndexConstraint(Constraint *constraint, CreateStmtContext *cxt)
|
||||
Relation rel;
|
||||
int count;
|
||||
|
||||
rel = heap_openrv(inh, AccessShareLock);
|
||||
rel = table_openrv(inh, AccessShareLock);
|
||||
/* check user requested inheritance from valid relkind */
|
||||
if (rel->rd_rel->relkind != RELKIND_RELATION &&
|
||||
rel->rd_rel->relkind != RELKIND_FOREIGN_TABLE &&
|
||||
@ -2310,7 +2310,7 @@ transformIndexConstraint(Constraint *constraint, CreateStmtContext *cxt)
|
||||
break;
|
||||
}
|
||||
}
|
||||
heap_close(rel, NoLock);
|
||||
table_close(rel, NoLock);
|
||||
if (found)
|
||||
break;
|
||||
}
|
||||
@ -2550,7 +2550,7 @@ transformIndexStmt(Oid relid, IndexStmt *stmt, const char *queryString)
|
||||
free_parsestate(pstate);
|
||||
|
||||
/* Close relation */
|
||||
heap_close(rel, NoLock);
|
||||
table_close(rel, NoLock);
|
||||
|
||||
/* Mark statement as successfully transformed */
|
||||
stmt->transformed = true;
|
||||
@ -2586,7 +2586,7 @@ transformRuleStmt(RuleStmt *stmt, const char *queryString,
|
||||
* DefineQueryRewrite(), and we don't want to grab a lesser lock
|
||||
* beforehand.
|
||||
*/
|
||||
rel = heap_openrv(stmt->relation, AccessExclusiveLock);
|
||||
rel = table_openrv(stmt->relation, AccessExclusiveLock);
|
||||
|
||||
if (rel->rd_rel->relkind == RELKIND_MATVIEW)
|
||||
ereport(ERROR,
|
||||
@ -2864,7 +2864,7 @@ transformRuleStmt(RuleStmt *stmt, const char *queryString,
|
||||
free_parsestate(pstate);
|
||||
|
||||
/* Close relation, but keep the exclusive lock */
|
||||
heap_close(rel, NoLock);
|
||||
table_close(rel, NoLock);
|
||||
}
|
||||
|
||||
|
||||
|
Reference in New Issue
Block a user