aboutsummaryrefslogtreecommitdiff
path: root/src/backend/utils
diff options
context:
space:
mode:
Diffstat (limited to 'src/backend/utils')
-rw-r--r--src/backend/utils/adt/ruleutils.c6
-rw-r--r--src/backend/utils/cache/inval.c6
-rw-r--r--src/backend/utils/cache/relcache.c35
-rw-r--r--src/backend/utils/init/flatfiles.c14
4 files changed, 37 insertions, 24 deletions
diff --git a/src/backend/utils/adt/ruleutils.c b/src/backend/utils/adt/ruleutils.c
index a6e5699357c..af840cdf971 100644
--- a/src/backend/utils/adt/ruleutils.c
+++ b/src/backend/utils/adt/ruleutils.c
@@ -3,7 +3,7 @@
* back to source text
*
* IDENTIFICATION
- * $PostgreSQL: pgsql/src/backend/utils/adt/ruleutils.c,v 1.191 2005/04/07 01:51:39 neilc Exp $
+ * $PostgreSQL: pgsql/src/backend/utils/adt/ruleutils.c,v 1.192 2005/04/14 01:38:19 tgl Exp $
*
* This software is copyrighted by Jan Wieck - Hamburg.
*
@@ -1274,7 +1274,7 @@ pg_get_serial_sequence(PG_FUNCTION_ARGS)
ScanKeyInit(&key[0],
Anum_pg_depend_refclassid,
BTEqualStrategyNumber, F_OIDEQ,
- ObjectIdGetDatum(RelOid_pg_class));
+ ObjectIdGetDatum(RelationRelationId));
ScanKeyInit(&key[1],
Anum_pg_depend_refobjid,
BTEqualStrategyNumber, F_OIDEQ,
@@ -1295,7 +1295,7 @@ pg_get_serial_sequence(PG_FUNCTION_ARGS)
* We assume any internal dependency of a relation on a column
* must be what we are looking for.
*/
- if (deprec->classid == RelOid_pg_class &&
+ if (deprec->classid == RelationRelationId &&
deprec->objsubid == 0 &&
deprec->deptype == DEPENDENCY_INTERNAL)
{
diff --git a/src/backend/utils/cache/inval.c b/src/backend/utils/cache/inval.c
index 21954589829..61b7522f8c9 100644
--- a/src/backend/utils/cache/inval.c
+++ b/src/backend/utils/cache/inval.c
@@ -80,7 +80,7 @@
* Portions Copyright (c) 1994, Regents of the University of California
*
* IDENTIFICATION
- * $PostgreSQL: pgsql/src/backend/utils/cache/inval.c,v 1.70 2005/01/10 21:57:17 tgl Exp $
+ * $PostgreSQL: pgsql/src/backend/utils/cache/inval.c,v 1.71 2005/04/14 01:38:19 tgl Exp $
*
*-------------------------------------------------------------------------
*/
@@ -541,7 +541,7 @@ PrepareForTupleInvalidation(Relation relation, HeapTuple tuple)
*/
tupleRelId = RelationGetRelid(relation);
- if (tupleRelId == RelOid_pg_class)
+ if (tupleRelId == RelationRelationId)
{
Form_pg_class classtup = (Form_pg_class) GETSTRUCT(tuple);
RelFileNode rnode;
@@ -575,7 +575,7 @@ PrepareForTupleInvalidation(Relation relation, HeapTuple tuple)
rnode.relNode = classtup->relfilenode;
RegisterSmgrInvalidation(rnode);
}
- else if (tupleRelId == RelOid_pg_attribute)
+ else if (tupleRelId == AttributeRelationId)
{
Form_pg_attribute atttup = (Form_pg_attribute) GETSTRUCT(tuple);
diff --git a/src/backend/utils/cache/relcache.c b/src/backend/utils/cache/relcache.c
index 109a6e811aa..e6c59b1815b 100644
--- a/src/backend/utils/cache/relcache.c
+++ b/src/backend/utils/cache/relcache.c
@@ -8,7 +8,7 @@
*
*
* IDENTIFICATION
- * $PostgreSQL: pgsql/src/backend/utils/cache/relcache.c,v 1.218 2005/03/29 00:17:11 tgl Exp $
+ * $PostgreSQL: pgsql/src/backend/utils/cache/relcache.c,v 1.219 2005/04/14 01:38:19 tgl Exp $
*
*-------------------------------------------------------------------------
*/
@@ -2150,18 +2150,36 @@ RelationBuildLocalRelation(const char *relname,
TupleDesc tupDesc,
Oid relid,
Oid reltablespace,
- bool shared_relation,
- bool nailit)
+ bool shared_relation)
{
Relation rel;
MemoryContext oldcxt;
int natts = tupDesc->natts;
int i;
bool has_not_null;
+ bool nailit;
AssertArg(natts >= 0);
/*
+ * check for creation of a rel that must be nailed in cache.
+ *
+ * XXX this list had better match RelationCacheInitialize's list.
+ */
+ switch (relid)
+ {
+ case RelationRelationId:
+ case AttributeRelationId:
+ case ProcedureRelationId:
+ case TypeRelationId:
+ nailit = true;
+ break;
+ default:
+ nailit = false;
+ break;
+ }
+
+ /*
* switch to the cache context to create the relcache entry.
*/
if (!CacheMemoryContext)
@@ -2179,6 +2197,9 @@ RelationBuildLocalRelation(const char *relname,
/* make sure relation is marked as having no open file yet */
rel->rd_smgr = NULL;
+ /* mark it nailed if appropriate */
+ rel->rd_isnailed = nailit;
+
rel->rd_refcnt = nailit ? 1 : 0;
/* it's being created in this transaction */
@@ -2191,14 +2212,6 @@ RelationBuildLocalRelation(const char *relname,
rel->rd_istemp = isTempNamespace(relnamespace);
/*
- * nail the reldesc if this is a bootstrap create reln and we may need
- * it in the cache later on in the bootstrap process so we don't ever
- * want it kicked out. e.g. pg_attribute!!!
- */
- if (nailit)
- rel->rd_isnailed = true;
-
- /*
* create a new tuple descriptor from the one passed in. We do this
* partly to copy it into the cache context, and partly because the
* new relation can't have any defaults or constraints yet; they have
diff --git a/src/backend/utils/init/flatfiles.c b/src/backend/utils/init/flatfiles.c
index e7ddd0a42c1..4dc27dcdf5a 100644
--- a/src/backend/utils/init/flatfiles.c
+++ b/src/backend/utils/init/flatfiles.c
@@ -22,7 +22,7 @@
* Portions Copyright (c) 1996-2005, PostgreSQL Global Development Group
* Portions Copyright (c) 1994, Regents of the University of California
*
- * $PostgreSQL: pgsql/src/backend/utils/init/flatfiles.c,v 1.4 2005/02/26 18:43:33 tgl Exp $
+ * $PostgreSQL: pgsql/src/backend/utils/init/flatfiles.c,v 1.5 2005/04/14 01:38:20 tgl Exp $
*
*-------------------------------------------------------------------------
*/
@@ -643,7 +643,7 @@ BuildFlatFiles(bool database_only)
/* hard-wired path to pg_database */
rnode.spcNode = GLOBALTABLESPACE_OID;
rnode.dbNode = 0;
- rnode.relNode = RelOid_pg_database;
+ rnode.relNode = DatabaseRelationId;
/* No locking is needed because no one else is alive yet */
rel = XLogOpenRelation(true, 0, rnode);
@@ -654,7 +654,7 @@ BuildFlatFiles(bool database_only)
/* hard-wired path to pg_group */
rnode.spcNode = GLOBALTABLESPACE_OID;
rnode.dbNode = 0;
- rnode.relNode = RelOid_pg_group;
+ rnode.relNode = GroupRelationId;
rel = XLogOpenRelation(true, 0, rnode);
write_group_file(rel);
@@ -662,7 +662,7 @@ BuildFlatFiles(bool database_only)
/* hard-wired path to pg_shadow */
rnode.spcNode = GLOBALTABLESPACE_OID;
rnode.dbNode = 0;
- rnode.relNode = RelOid_pg_shadow;
+ rnode.relNode = ShadowRelationId;
rel = XLogOpenRelation(true, 0, rnode);
write_user_file(rel);
@@ -816,13 +816,13 @@ flatfile_update_trigger(PG_FUNCTION_ARGS)
switch (RelationGetRelid(trigdata->tg_relation))
{
- case RelOid_pg_database:
+ case DatabaseRelationId:
database_file_update_needed();
break;
- case RelOid_pg_group:
+ case GroupRelationId:
group_file_update_needed();
break;
- case RelOid_pg_shadow:
+ case ShadowRelationId:
user_file_update_needed();
break;
default: