mirror of
https://github.com/postgres/postgres.git
synced 2025-09-02 04:21:28 +03:00
Completion of project to use fixed OIDs for all system catalogs and
indexes. Replace all heap_openr and index_openr calls by heap_open and index_open. Remove runtime lookups of catalog OID numbers in various places. Remove relcache's support for looking up system catalogs by name. Bulky but mostly very boring patch ...
This commit is contained in:
@@ -8,14 +8,13 @@
|
||||
*
|
||||
*
|
||||
* IDENTIFICATION
|
||||
* $PostgreSQL: pgsql/src/backend/rewrite/rewriteDefine.c,v 1.103 2005/04/14 01:38:17 tgl Exp $
|
||||
* $PostgreSQL: pgsql/src/backend/rewrite/rewriteDefine.c,v 1.104 2005/04/14 20:03:25 tgl Exp $
|
||||
*
|
||||
*-------------------------------------------------------------------------
|
||||
*/
|
||||
#include "postgres.h"
|
||||
|
||||
#include "access/heapam.h"
|
||||
#include "catalog/catname.h"
|
||||
#include "catalog/dependency.h"
|
||||
#include "catalog/indexing.h"
|
||||
#include "catalog/pg_rewrite.h"
|
||||
@@ -87,7 +86,7 @@ InsertRule(char *rulname,
|
||||
/*
|
||||
* Ready to store new pg_rewrite tuple
|
||||
*/
|
||||
pg_rewrite_desc = heap_openr(RewriteRelationName, RowExclusiveLock);
|
||||
pg_rewrite_desc = heap_open(RewriteRelationId, RowExclusiveLock);
|
||||
|
||||
/*
|
||||
* Check to see if we are replacing an existing tuple
|
||||
@@ -139,8 +138,7 @@ InsertRule(char *rulname,
|
||||
|
||||
/* If replacing, get rid of old dependencies and make new ones */
|
||||
if (is_update)
|
||||
deleteDependencyRecordsFor(RelationGetRelid(pg_rewrite_desc),
|
||||
rewriteObjectId);
|
||||
deleteDependencyRecordsFor(RewriteRelationId, rewriteObjectId);
|
||||
|
||||
/*
|
||||
* Install dependency on rule's relation to ensure it will go away on
|
||||
@@ -570,7 +568,7 @@ RenameRewriteRule(Oid owningRel, const char *oldName,
|
||||
Relation pg_rewrite_desc;
|
||||
HeapTuple ruletup;
|
||||
|
||||
pg_rewrite_desc = heap_openr(RewriteRelationName, RowExclusiveLock);
|
||||
pg_rewrite_desc = heap_open(RewriteRelationId, RowExclusiveLock);
|
||||
|
||||
ruletup = SearchSysCacheCopy(RULERELNAME,
|
||||
ObjectIdGetDatum(owningRel),
|
||||
|
@@ -8,7 +8,7 @@
|
||||
*
|
||||
*
|
||||
* IDENTIFICATION
|
||||
* $PostgreSQL: pgsql/src/backend/rewrite/rewriteRemove.c,v 1.61 2004/12/31 22:00:46 pgsql Exp $
|
||||
* $PostgreSQL: pgsql/src/backend/rewrite/rewriteRemove.c,v 1.62 2005/04/14 20:03:25 tgl Exp $
|
||||
*
|
||||
*-------------------------------------------------------------------------
|
||||
*/
|
||||
@@ -16,7 +16,6 @@
|
||||
|
||||
#include "access/genam.h"
|
||||
#include "access/heapam.h"
|
||||
#include "catalog/catname.h"
|
||||
#include "catalog/dependency.h"
|
||||
#include "catalog/indexing.h"
|
||||
#include "catalog/pg_rewrite.h"
|
||||
@@ -72,7 +71,7 @@ RemoveRewriteRule(Oid owningRel, const char *ruleName, DropBehavior behavior)
|
||||
/*
|
||||
* Do the deletion
|
||||
*/
|
||||
object.classId = get_system_catalog_relid(RewriteRelationName);
|
||||
object.classId = RewriteRelationId;
|
||||
object.objectId = HeapTupleGetOid(tuple);
|
||||
object.objectSubId = 0;
|
||||
|
||||
@@ -99,7 +98,7 @@ RemoveRewriteRuleById(Oid ruleOid)
|
||||
/*
|
||||
* Open the pg_rewrite relation.
|
||||
*/
|
||||
RewriteRelation = heap_openr(RewriteRelationName, RowExclusiveLock);
|
||||
RewriteRelation = heap_open(RewriteRelationId, RowExclusiveLock);
|
||||
|
||||
/*
|
||||
* Find the tuple for the target rule.
|
||||
@@ -109,7 +108,7 @@ RemoveRewriteRuleById(Oid ruleOid)
|
||||
BTEqualStrategyNumber, F_OIDEQ,
|
||||
ObjectIdGetDatum(ruleOid));
|
||||
|
||||
rcscan = systable_beginscan(RewriteRelation, RewriteOidIndex, true,
|
||||
rcscan = systable_beginscan(RewriteRelation, RewriteOidIndexId, true,
|
||||
SnapshotNow, 1, skey);
|
||||
|
||||
tuple = systable_getnext(rcscan);
|
||||
|
@@ -8,14 +8,13 @@
|
||||
*
|
||||
*
|
||||
* IDENTIFICATION
|
||||
* $PostgreSQL: pgsql/src/backend/rewrite/rewriteSupport.c,v 1.60 2004/12/31 22:00:46 pgsql Exp $
|
||||
* $PostgreSQL: pgsql/src/backend/rewrite/rewriteSupport.c,v 1.61 2005/04/14 20:03:25 tgl Exp $
|
||||
*
|
||||
*-------------------------------------------------------------------------
|
||||
*/
|
||||
#include "postgres.h"
|
||||
|
||||
#include "access/heapam.h"
|
||||
#include "catalog/catname.h"
|
||||
#include "catalog/indexing.h"
|
||||
#include "rewrite/rewriteSupport.h"
|
||||
#include "utils/inval.h"
|
||||
@@ -60,7 +59,7 @@ SetRelationRuleStatus(Oid relationId, bool relHasRules,
|
||||
* Find the tuple to update in pg_class, using syscache for the
|
||||
* lookup.
|
||||
*/
|
||||
relationRelation = heap_openr(RelationRelationName, RowExclusiveLock);
|
||||
relationRelation = heap_open(RelationRelationId, RowExclusiveLock);
|
||||
tuple = SearchSysCacheCopy(RELOID,
|
||||
ObjectIdGetDatum(relationId),
|
||||
0, 0, 0);
|
||||
|
Reference in New Issue
Block a user