aboutsummaryrefslogtreecommitdiff
path: root/src/backend/utils
diff options
context:
space:
mode:
Diffstat (limited to 'src/backend/utils')
-rw-r--r--src/backend/utils/cache/relcache.c17
-rw-r--r--src/backend/utils/init/postinit.c15
-rw-r--r--src/backend/utils/misc/database.c12
3 files changed, 41 insertions, 3 deletions
diff --git a/src/backend/utils/cache/relcache.c b/src/backend/utils/cache/relcache.c
index e39f1cfd12d..755359e2514 100644
--- a/src/backend/utils/cache/relcache.c
+++ b/src/backend/utils/cache/relcache.c
@@ -8,7 +8,7 @@
*
*
* IDENTIFICATION
- * $Header: /cvsroot/pgsql/src/backend/utils/cache/relcache.c,v 1.111 2000/09/12 04:49:13 momjian Exp $
+ * $Header: /cvsroot/pgsql/src/backend/utils/cache/relcache.c,v 1.112 2000/10/16 14:52:13 vadim Exp $
*
*-------------------------------------------------------------------------
*/
@@ -1017,6 +1017,12 @@ RelationBuildDesc(RelationBuildDescInfo buildinfo,
*/
RelationInitLockInfo(relation); /* see lmgr.c */
+ if (IsSharedSystemRelationName(NameStr(relation->rd_rel->relname)))
+ relation->rd_node.tblNode = InvalidOid;
+ else
+ relation->rd_node.tblNode = MyDatabaseId;
+ relation->rd_node.relNode = relation->rd_rel->relfilenode;
+
/* ----------------
* open the relation and assign the file descriptor returned
* by the storage manager code to rd_fd.
@@ -1192,6 +1198,13 @@ formrdesc(char *relationName,
*/
RelationCacheInsert(relation);
+ if (IsSharedSystemRelationName(relationName))
+ relation->rd_node.tblNode = InvalidOid;
+ else
+ relation->rd_node.tblNode = MyDatabaseId;
+ relation->rd_node.relNode =
+ relation->rd_rel->relfilenode = RelationGetRelid(relation);
+
/*
* Determining this requires a scan on pg_class, but to do the scan
* the rdesc for pg_class must already exist. Therefore we must do
@@ -2438,6 +2451,8 @@ init_irels(void)
/* the file descriptor is not yet opened */
ird->rd_fd = -1;
+ ird->rd_node.tblNode = MyDatabaseId;
+
/* next, read the access method tuple form */
if ((nread = FileRead(fd, (char *) &len, sizeof(len))) != sizeof(len))
{
diff --git a/src/backend/utils/init/postinit.c b/src/backend/utils/init/postinit.c
index cc3a3825c40..cee8dfaac90 100644
--- a/src/backend/utils/init/postinit.c
+++ b/src/backend/utils/init/postinit.c
@@ -8,7 +8,7 @@
*
*
* IDENTIFICATION
- * $Header: /cvsroot/pgsql/src/backend/utils/init/postinit.c,v 1.67 2000/10/02 19:42:54 petere Exp $
+ * $Header: /cvsroot/pgsql/src/backend/utils/init/postinit.c,v 1.68 2000/10/16 14:52:15 vadim Exp $
*
*
*-------------------------------------------------------------------------
@@ -21,6 +21,10 @@
#include <math.h>
#include <unistd.h>
+#ifndef OLD_FILE_NAMING
+#include "catalog/catalog.h"
+#endif
+
#include "access/heapam.h"
#include "catalog/catname.h"
#include "catalog/pg_database.h"
@@ -242,7 +246,12 @@ InitPostgres(const char *dbname, const char *username)
*/
if (bootstrap)
{
+ MyDatabaseId = TemplateDbOid;
+#ifdef OLD_FILE_NAMING
SetDatabasePath(ExpandDatabasePath(dbname));
+#else
+ SetDatabasePath(GetDatabasePath(MyDatabaseId));
+#endif
LockDisable(true);
}
else
@@ -276,9 +285,13 @@ InitPostgres(const char *dbname, const char *username)
"Database \"%s\" does not exist in the system catalog.",
dbname);
+#ifdef OLD_FILE_NAMING
fullpath = ExpandDatabasePath(datpath);
if (!fullpath)
elog(FATAL, "Database path could not be resolved.");
+#else
+ fullpath = GetDatabasePath(MyDatabaseId);
+#endif
/* Verify the database path */
diff --git a/src/backend/utils/misc/database.c b/src/backend/utils/misc/database.c
index 4be24e164f1..f415e5aee18 100644
--- a/src/backend/utils/misc/database.c
+++ b/src/backend/utils/misc/database.c
@@ -8,7 +8,7 @@
*
*
* IDENTIFICATION
- * $Header: /cvsroot/pgsql/src/backend/utils/misc/Attic/database.c,v 1.39 2000/07/03 20:48:42 petere Exp $
+ * $Header: /cvsroot/pgsql/src/backend/utils/misc/Attic/database.c,v 1.40 2000/10/16 14:52:19 vadim Exp $
*
*-------------------------------------------------------------------------
*/
@@ -22,6 +22,7 @@
#include "access/xact.h"
#include "catalog/catname.h"
+#include "catalog/catalog.h"
#include "catalog/pg_database.h"
#include "miscadmin.h"
#include "utils/syscache.h"
@@ -143,8 +144,17 @@ GetRawDatabaseInfo(const char *name, Oid *db_id, char *path)
char *dbfname;
Form_pg_database tup_db;
+#ifdef OLD_FILE_NAMING
dbfname = (char *) palloc(strlen(DataDir) + 8 + strlen(DatabaseRelationName) + 2);
sprintf(dbfname, "%s/global/%s", DataDir, DatabaseRelationName);
+#else
+ {
+ RelFileNode rnode;
+ rnode.tblNode = 0;
+ rnode.relNode = RelOid_pg_database;
+ dbfname = relpath(rnode);
+ }
+#endif
if ((dbfd = open(dbfname, O_RDONLY | PG_BINARY, 0)) < 0)
elog(FATAL, "cannot open %s: %s", dbfname, strerror(errno));