|
8 | 8 | *
|
9 | 9 | *
|
10 | 10 | * IDENTIFICATION
|
11 |
| - * $Header: /cvsroot/pgsql/src/backend/catalog/catalog.c,v 1.41 2001/05/30 14:15:26 momjian Exp $ |
| 11 | + * $Header: /cvsroot/pgsql/src/backend/catalog/catalog.c,v 1.42 2001/05/30 20:52:32 momjian Exp $ |
12 | 12 | *
|
13 | 13 | *-------------------------------------------------------------------------
|
14 | 14 | */
|
|
22 | 22 | #include "miscadmin.h"
|
23 | 23 | #include "utils/lsyscache.h"
|
24 | 24 |
|
25 |
| -#ifdef OLD_FILE_NAMING |
26 |
| -/* |
27 |
| - * relpath - construct path to a relation's file |
28 |
| - * |
29 |
| - * Note that this only works with relations that are visible to the current |
30 |
| - * backend, ie, either in the current database or shared system relations. |
31 |
| - * |
32 |
| - * Result is a palloc'd string. |
33 |
| - */ |
34 |
| -char * |
35 |
| -relpath(const char *relname) |
36 |
| -{ |
37 |
| - char *path; |
38 |
| - |
39 |
| - if (IsSharedSystemRelationName(relname)) |
40 |
| - { |
41 |
| - /* Shared system relations live in {datadir}/global */ |
42 |
| - size_t bufsize = strlen(DataDir) + 8 + sizeof(NameData) + 1; |
43 |
| - |
44 |
| - path = (char *) palloc(bufsize); |
45 |
| - snprintf(path, bufsize, "%s/global/%s", DataDir, relname); |
46 |
| - return path; |
47 |
| - } |
48 |
| - |
49 |
| - /* |
50 |
| - * If it is in the current database, assume it is in current working |
51 |
| - * directory. NB: this does not work during bootstrap! |
52 |
| - */ |
53 |
| - return pstrdup(relname); |
54 |
| -} |
55 |
| - |
56 |
| -/* |
57 |
| - * relpath_blind - construct path to a relation's file |
58 |
| - * |
59 |
| - * Construct the path using only the info available to smgrblindwrt, |
60 |
| - * namely the names and OIDs of the database and relation. (Shared system |
61 |
| - * relations are identified with dbid = 0.) Note that we may have to |
62 |
| - * access a relation belonging to a different database! |
63 |
| - * |
64 |
| - * Result is a palloc'd string. |
65 |
| - */ |
66 |
| - |
67 |
| -char * |
68 |
| -relpath_blind(const char *dbname, const char *relname, |
69 |
| - Oid dbid, Oid relid) |
70 |
| -{ |
71 |
| - char *path; |
72 |
| - |
73 |
| - if (dbid == (Oid) 0) |
74 |
| - { |
75 |
| - /* Shared system relations live in {datadir}/global */ |
76 |
| - path = (char *) palloc(strlen(DataDir) + 8 + sizeof(NameData) + 1); |
77 |
| - sprintf(path, "%s/global/%s", DataDir, relname); |
78 |
| - } |
79 |
| - else if (dbid == MyDatabaseId) |
80 |
| - { |
81 |
| - /* XXX why is this inconsistent with relpath() ? */ |
82 |
| - path = (char *) palloc(strlen(DatabasePath) + sizeof(NameData) + 2); |
83 |
| - sprintf(path, "%s/%s", DatabasePath, relname); |
84 |
| - } |
85 |
| - else |
86 |
| - { |
87 |
| - /* this is work around only !!! */ |
88 |
| - char dbpathtmp[MAXPGPATH]; |
89 |
| - Oid id; |
90 |
| - char *dbpath; |
91 |
| - |
92 |
| - GetRawDatabaseInfo(dbname, &id, dbpathtmp); |
93 |
| - |
94 |
| - if (id != dbid) |
95 |
| - elog(FATAL, "relpath_blind: oid of db %s is not %u", |
96 |
| - dbname, dbid); |
97 |
| - dbpath = ExpandDatabasePath(dbpathtmp); |
98 |
| - if (dbpath == NULL) |
99 |
| - elog(FATAL, "relpath_blind: can't expand path for db %s", |
100 |
| - dbname); |
101 |
| - path = (char *) palloc(strlen(dbpath) + sizeof(NameData) + 2); |
102 |
| - sprintf(path, "%s/%s", dbpath, relname); |
103 |
| - pfree(dbpath); |
104 |
| - } |
105 |
| - return path; |
106 |
| -} |
107 |
| - |
108 |
| -#else /* ! OLD_FILE_NAMING */ |
109 |
| - |
110 | 25 | /*
|
111 | 26 | * relpath - construct path to a relation's file
|
112 | 27 | *
|
@@ -157,7 +72,6 @@ GetDatabasePath(Oid tblNode)
|
157 | 72 | return path;
|
158 | 73 | }
|
159 | 74 |
|
160 |
| -#endif /* OLD_FILE_NAMING */ |
161 | 75 |
|
162 | 76 | /*
|
163 | 77 | * IsSystemRelationName
|
|
0 commit comments