7
7
*
8
8
*
9
9
* IDENTIFICATION
10
- * $Header: /cvsroot/pgsql/src/backend/parser/Attic/dbcommands.c,v 1.10 1997/11/07 06:37:55 thomas Exp $
10
+ * $Header: /cvsroot/pgsql/src/backend/parser/Attic/dbcommands.c,v 1.11 1997/11/10 15:17:44 thomas Exp $
11
11
*
12
12
*-------------------------------------------------------------------------
13
13
*/
@@ -74,6 +74,11 @@ createdb(char *dbname, char *dbpath)
74
74
75
75
lp = ExpandDatabasePath (loc );
76
76
77
+ if (lp == NULL )
78
+ elog (WARN ,"Unable to locate path '%s'"
79
+ "\n\tThis may be due to a missing environment variable"
80
+ " in the server" ,loc );
81
+
77
82
if (mkdir (lp ,S_IRWXU ) != 0 )
78
83
elog (WARN ,"Unable to create database directory %s" ,lp );
79
84
@@ -101,11 +106,6 @@ destroydb(char *dbname)
101
106
char * path ;
102
107
char dbpath [MAXPGPATH + 1 ];
103
108
char buf [512 ];
104
- char loc [512 ];
105
- text * dbtext ;
106
-
107
- Relation dbrel ;
108
- HeapTuple dbtup ;
109
109
110
110
/*
111
111
* If this call returns, the database exists and we're allowed to
@@ -121,34 +121,11 @@ destroydb(char *dbname)
121
121
/* stop the vacuum daemon */
122
122
stop_vacuum (dbpath , dbname );
123
123
124
- #if FALSE
125
- dbrel = heap_openr (DatabaseRelationName );
126
- if (!RelationIsValid (dbrel ))
127
- elog (FATAL , "%s: cannot open relation \"%-.*s\"" ,
128
- "destroydb" , DatabaseRelationName );
129
-
130
- dbtup = get_pg_dbtup ("destroydb" , dbname , dbrel );
131
-
132
- if (!HeapTupleIsValid (dbtup ))
133
- elog (NOTICE ,"destroydb: pg_database entry not found %s" ,dbname );
134
-
135
- dbtext = (text * ) heap_getattr (dbtup , InvalidBuffer ,
136
- Anum_pg_database_datpath ,
137
- RelationGetTupleDescriptor (dbrel ),
138
- (char * ) NULL );
139
- memcpy (loc , VARDATA (dbtext ), (VARSIZE (dbtext )- VARHDRSZ ));
140
- * (loc + (VARSIZE (dbtext )- VARHDRSZ )) = '\0' ;
141
-
142
- #if FALSE
143
- if (* loc != SEP_CHAR )
144
- {
145
- sprintf (buf , "%s/base/%s" , DataDir , loc );
146
- strcpy (loc , buf );
147
- }
148
- #endif
149
-
150
- heap_close (dbrel );
151
- #endif
124
+ path = ExpandDatabasePath (dbpath );
125
+ if (path == NULL )
126
+ elog (WARN ,"Unable to locate path '%s'"
127
+ "\n\tThis may be due to a missing environment variable"
128
+ " in the server" ,dbpath );
152
129
153
130
/*
154
131
* remove the pg_database tuple FIRST, this may fail due to
@@ -162,7 +139,6 @@ destroydb(char *dbname)
162
139
* remove the data directory. If the DELETE above failed, this will
163
140
* not be reached
164
141
*/
165
- path = ExpandDatabasePath (dbpath );
166
142
167
143
sprintf (buf , "rm -r %s" , path );
168
144
system (buf );
0 commit comments