mirror of
https://github.com/postgres/postgres.git
synced 2025-07-08 11:42:09 +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:
@ -192,7 +192,7 @@ DefineTSParser(List *names, List *parameters)
|
||||
(errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
|
||||
errmsg("must be superuser to create text search parsers")));
|
||||
|
||||
prsRel = heap_open(TSParserRelationId, RowExclusiveLock);
|
||||
prsRel = table_open(TSParserRelationId, RowExclusiveLock);
|
||||
|
||||
/* Convert list of names to a name and namespace */
|
||||
namespaceoid = QualifiedNameGetCreationNamespace(names, &prsname);
|
||||
@ -284,7 +284,7 @@ DefineTSParser(List *names, List *parameters)
|
||||
|
||||
heap_freetuple(tup);
|
||||
|
||||
heap_close(prsRel, RowExclusiveLock);
|
||||
table_close(prsRel, RowExclusiveLock);
|
||||
|
||||
return address;
|
||||
}
|
||||
@ -298,7 +298,7 @@ RemoveTSParserById(Oid prsId)
|
||||
Relation relation;
|
||||
HeapTuple tup;
|
||||
|
||||
relation = heap_open(TSParserRelationId, RowExclusiveLock);
|
||||
relation = table_open(TSParserRelationId, RowExclusiveLock);
|
||||
|
||||
tup = SearchSysCache1(TSPARSEROID, ObjectIdGetDatum(prsId));
|
||||
|
||||
@ -309,7 +309,7 @@ RemoveTSParserById(Oid prsId)
|
||||
|
||||
ReleaseSysCache(tup);
|
||||
|
||||
heap_close(relation, RowExclusiveLock);
|
||||
table_close(relation, RowExclusiveLock);
|
||||
}
|
||||
|
||||
/* ---------------------- TS Dictionary commands -----------------------*/
|
||||
@ -464,7 +464,7 @@ DefineTSDictionary(List *names, List *parameters)
|
||||
verify_dictoptions(templId, dictoptions);
|
||||
|
||||
|
||||
dictRel = heap_open(TSDictionaryRelationId, RowExclusiveLock);
|
||||
dictRel = table_open(TSDictionaryRelationId, RowExclusiveLock);
|
||||
|
||||
/*
|
||||
* Looks good, insert
|
||||
@ -497,7 +497,7 @@ DefineTSDictionary(List *names, List *parameters)
|
||||
|
||||
heap_freetuple(tup);
|
||||
|
||||
heap_close(dictRel, RowExclusiveLock);
|
||||
table_close(dictRel, RowExclusiveLock);
|
||||
|
||||
return address;
|
||||
}
|
||||
@ -511,7 +511,7 @@ RemoveTSDictionaryById(Oid dictId)
|
||||
Relation relation;
|
||||
HeapTuple tup;
|
||||
|
||||
relation = heap_open(TSDictionaryRelationId, RowExclusiveLock);
|
||||
relation = table_open(TSDictionaryRelationId, RowExclusiveLock);
|
||||
|
||||
tup = SearchSysCache1(TSDICTOID, ObjectIdGetDatum(dictId));
|
||||
|
||||
@ -523,7 +523,7 @@ RemoveTSDictionaryById(Oid dictId)
|
||||
|
||||
ReleaseSysCache(tup);
|
||||
|
||||
heap_close(relation, RowExclusiveLock);
|
||||
table_close(relation, RowExclusiveLock);
|
||||
}
|
||||
|
||||
/*
|
||||
@ -547,7 +547,7 @@ AlterTSDictionary(AlterTSDictionaryStmt *stmt)
|
||||
|
||||
dictId = get_ts_dict_oid(stmt->dictname, false);
|
||||
|
||||
rel = heap_open(TSDictionaryRelationId, RowExclusiveLock);
|
||||
rel = table_open(TSDictionaryRelationId, RowExclusiveLock);
|
||||
|
||||
tup = SearchSysCache1(TSDICTOID, ObjectIdGetDatum(dictId));
|
||||
|
||||
@ -639,7 +639,7 @@ AlterTSDictionary(AlterTSDictionaryStmt *stmt)
|
||||
heap_freetuple(newtup);
|
||||
ReleaseSysCache(tup);
|
||||
|
||||
heap_close(rel, RowExclusiveLock);
|
||||
table_close(rel, RowExclusiveLock);
|
||||
|
||||
return address;
|
||||
}
|
||||
@ -756,7 +756,7 @@ DefineTSTemplate(List *names, List *parameters)
|
||||
/* Convert list of names to a name and namespace */
|
||||
namespaceoid = QualifiedNameGetCreationNamespace(names, &tmplname);
|
||||
|
||||
tmplRel = heap_open(TSTemplateRelationId, RowExclusiveLock);
|
||||
tmplRel = table_open(TSTemplateRelationId, RowExclusiveLock);
|
||||
|
||||
for (i = 0; i < Natts_pg_ts_template; i++)
|
||||
{
|
||||
@ -819,7 +819,7 @@ DefineTSTemplate(List *names, List *parameters)
|
||||
|
||||
heap_freetuple(tup);
|
||||
|
||||
heap_close(tmplRel, RowExclusiveLock);
|
||||
table_close(tmplRel, RowExclusiveLock);
|
||||
|
||||
return address;
|
||||
}
|
||||
@ -833,7 +833,7 @@ RemoveTSTemplateById(Oid tmplId)
|
||||
Relation relation;
|
||||
HeapTuple tup;
|
||||
|
||||
relation = heap_open(TSTemplateRelationId, RowExclusiveLock);
|
||||
relation = table_open(TSTemplateRelationId, RowExclusiveLock);
|
||||
|
||||
tup = SearchSysCache1(TSTEMPLATEOID, ObjectIdGetDatum(tmplId));
|
||||
|
||||
@ -845,7 +845,7 @@ RemoveTSTemplateById(Oid tmplId)
|
||||
|
||||
ReleaseSysCache(tup);
|
||||
|
||||
heap_close(relation, RowExclusiveLock);
|
||||
table_close(relation, RowExclusiveLock);
|
||||
}
|
||||
|
||||
/* ---------------------- TS Configuration commands -----------------------*/
|
||||
@ -1052,7 +1052,7 @@ DefineTSConfiguration(List *names, List *parameters, ObjectAddress *copied)
|
||||
(errcode(ERRCODE_INVALID_OBJECT_DEFINITION),
|
||||
errmsg("text search parser is required")));
|
||||
|
||||
cfgRel = heap_open(TSConfigRelationId, RowExclusiveLock);
|
||||
cfgRel = table_open(TSConfigRelationId, RowExclusiveLock);
|
||||
|
||||
/*
|
||||
* Looks good, build tuple and insert
|
||||
@ -1082,7 +1082,7 @@ DefineTSConfiguration(List *names, List *parameters, ObjectAddress *copied)
|
||||
SysScanDesc scan;
|
||||
HeapTuple maptup;
|
||||
|
||||
mapRel = heap_open(TSConfigMapRelationId, RowExclusiveLock);
|
||||
mapRel = table_open(TSConfigMapRelationId, RowExclusiveLock);
|
||||
|
||||
ScanKeyInit(&skey,
|
||||
Anum_pg_ts_config_map_mapcfg,
|
||||
@ -1125,8 +1125,8 @@ DefineTSConfiguration(List *names, List *parameters, ObjectAddress *copied)
|
||||
heap_freetuple(tup);
|
||||
|
||||
if (mapRel)
|
||||
heap_close(mapRel, RowExclusiveLock);
|
||||
heap_close(cfgRel, RowExclusiveLock);
|
||||
table_close(mapRel, RowExclusiveLock);
|
||||
table_close(cfgRel, RowExclusiveLock);
|
||||
|
||||
return address;
|
||||
}
|
||||
@ -1144,7 +1144,7 @@ RemoveTSConfigurationById(Oid cfgId)
|
||||
SysScanDesc scan;
|
||||
|
||||
/* Remove the pg_ts_config entry */
|
||||
relCfg = heap_open(TSConfigRelationId, RowExclusiveLock);
|
||||
relCfg = table_open(TSConfigRelationId, RowExclusiveLock);
|
||||
|
||||
tup = SearchSysCache1(TSCONFIGOID, ObjectIdGetDatum(cfgId));
|
||||
|
||||
@ -1156,10 +1156,10 @@ RemoveTSConfigurationById(Oid cfgId)
|
||||
|
||||
ReleaseSysCache(tup);
|
||||
|
||||
heap_close(relCfg, RowExclusiveLock);
|
||||
table_close(relCfg, RowExclusiveLock);
|
||||
|
||||
/* Remove any pg_ts_config_map entries */
|
||||
relMap = heap_open(TSConfigMapRelationId, RowExclusiveLock);
|
||||
relMap = table_open(TSConfigMapRelationId, RowExclusiveLock);
|
||||
|
||||
ScanKeyInit(&skey,
|
||||
Anum_pg_ts_config_map_mapcfg,
|
||||
@ -1176,7 +1176,7 @@ RemoveTSConfigurationById(Oid cfgId)
|
||||
|
||||
systable_endscan(scan);
|
||||
|
||||
heap_close(relMap, RowExclusiveLock);
|
||||
table_close(relMap, RowExclusiveLock);
|
||||
}
|
||||
|
||||
/*
|
||||
@ -1205,7 +1205,7 @@ AlterTSConfiguration(AlterTSConfigurationStmt *stmt)
|
||||
aclcheck_error(ACLCHECK_NOT_OWNER, OBJECT_TSCONFIGURATION,
|
||||
NameListToString(stmt->cfgname));
|
||||
|
||||
relMap = heap_open(TSConfigMapRelationId, RowExclusiveLock);
|
||||
relMap = table_open(TSConfigMapRelationId, RowExclusiveLock);
|
||||
|
||||
/* Add or drop mappings */
|
||||
if (stmt->dicts)
|
||||
@ -1220,7 +1220,7 @@ AlterTSConfiguration(AlterTSConfigurationStmt *stmt)
|
||||
|
||||
ObjectAddressSet(address, TSConfigRelationId, cfgId);
|
||||
|
||||
heap_close(relMap, RowExclusiveLock);
|
||||
table_close(relMap, RowExclusiveLock);
|
||||
|
||||
ReleaseSysCache(tup);
|
||||
|
||||
|
Reference in New Issue
Block a user