7
7
*
8
8
*
9
9
* IDENTIFICATION
10
- * $Header: /cvsroot/pgsql/src/backend/commands/dbcommands.c,v 1.24 1998/09/01 04:27:51 momjian Exp $
10
+ * $Header: /cvsroot/pgsql/src/backend/commands/dbcommands.c,v 1.25 1998/10/05 02:49:36 thomas Exp $
11
11
*
12
12
*-------------------------------------------------------------------------
13
13
*/
@@ -77,20 +77,20 @@ createdb(char *dbname, char *dbpath, int encoding)
77
77
" in the server" , loc );
78
78
79
79
if (mkdir (lp , S_IRWXU ) != 0 )
80
- elog (ERROR , "Unable to create database directory %s " , lp );
80
+ elog (ERROR , "Unable to create database directory '%s' " , lp );
81
81
82
82
sprintf (buf , "%s %s%cbase%ctemplate1%c* %s" ,
83
83
COPY_CMD , DataDir , SEP_CHAR , SEP_CHAR , SEP_CHAR , lp );
84
84
system (buf );
85
85
86
86
#if FALSE
87
87
sprintf (buf , "insert into pg_database (datname, datdba, datpath) \
88
- values (\ '%s\ '::name, \ '%d\ '::oid, \ '%s\ '::text);" ,
88
+ values ('%s'::name, '%d'::oid, '%s'::text);" ,
89
89
dbname , user_id , dbname );
90
90
#endif
91
91
92
92
sprintf (buf , "insert into pg_database (datname, datdba, encoding, datpath)"
93
- " values (\ '%s\ ', \ '%d\ ', \ '%d\ ', \ '%s\ ');" , dbname , user_id , encoding , loc );
93
+ " values ('%s', '%d', '%d', '%s');" , dbname , user_id , encoding , loc );
94
94
95
95
96
96
pg_exec_query (buf );
@@ -112,7 +112,7 @@ destroydb(char *dbname)
112
112
check_permissions ("destroydb" , dbpath , dbname , & db_id , & user_id );
113
113
114
114
if (!OidIsValid (db_id ))
115
- elog (FATAL , "impossible: pg_database instance with invalid OID. " );
115
+ elog (FATAL , "pg_database instance has an invalid OID" );
116
116
117
117
/* stop the vacuum daemon */
118
118
stop_vacuum (dbpath , dbname );
@@ -156,7 +156,7 @@ get_pg_dbtup(char *command, char *dbname, Relation dbrel)
156
156
157
157
scan = heap_beginscan (dbrel , 0 , SnapshotNow , 1 , & scanKey );
158
158
if (!HeapScanIsValid (scan ))
159
- elog (ERROR , "%s: cannot begin scan of pg_database. " , command );
159
+ elog (ERROR , "%s: cannot begin scan of pg_database" , command );
160
160
161
161
/*
162
162
* since we want to return the tuple out of this proc, and we're going
@@ -211,17 +211,17 @@ check_permissions(char *command,
211
211
/* Check to make sure user has permission to use createdb */
212
212
if (!use_createdb )
213
213
{
214
- elog (ERROR , "user \"%s\" is not allowed to create/destroy databases" ,
214
+ elog (ERROR , "user '%s' is not allowed to create/destroy databases" ,
215
215
userName );
216
216
}
217
217
218
218
/* Make sure we are not mucking with the template database */
219
219
if (!strcmp (dbname , "template1" ))
220
- elog (ERROR , "%s cannot be executed on the template database. " , command );
220
+ elog (ERROR , "%s: cannot be executed on the template database" , command );
221
221
222
222
/* Check to make sure database is not the currently open database */
223
223
if (!strcmp (dbname , DatabaseName ))
224
- elog (ERROR , "%s cannot be executed on an open database" , command );
224
+ elog (ERROR , "%s: cannot be executed on an open database" , command );
225
225
226
226
/* Check to make sure database is owned by this user */
227
227
@@ -272,20 +272,20 @@ check_permissions(char *command,
272
272
if (dbfound && !strcmp (command , "createdb" ))
273
273
{
274
274
275
- elog (ERROR , "createdb: database %s already exists. " , dbname );
275
+ elog (ERROR , "createdb: database '%s' already exists" , dbname );
276
276
277
277
}
278
278
else if (!dbfound && !strcmp (command , "destroydb" ))
279
279
{
280
280
281
- elog (ERROR , "destroydb: database %s does not exist. " , dbname );
281
+ elog (ERROR , "destroydb: database '%s' does not exist" , dbname );
282
282
283
283
}
284
284
else if (dbfound && !strcmp (command , "destroydb" )
285
285
&& dbowner != * userIdP && use_super == false)
286
286
{
287
287
288
- elog (ERROR , "%s: database %s is not owned by you. " , command , dbname );
288
+ elog (ERROR , "%s: database '%s' is not owned by you" , command , dbname );
289
289
290
290
}
291
291
@@ -317,7 +317,7 @@ stop_vacuum(char *dbpath, char *dbname)
317
317
FreeFile (fp );
318
318
if (kill (pid , SIGKILLDAEMON1 ) < 0 )
319
319
{
320
- elog (ERROR , "can't kill vacuum daemon (pid %d) on %s " ,
320
+ elog (ERROR , "can't kill vacuum daemon (pid %d) on '%s' " ,
321
321
pid , dbname );
322
322
}
323
323
}
0 commit comments