Skip to content

Commit 86234a0

Browse files
author
Thomas G. Lockhart
committed
Fix up warning and error messages to use single-quotes around strings.
1 parent 60ed8bb commit 86234a0

File tree

1 file changed

+13
-13
lines changed

1 file changed

+13
-13
lines changed

src/backend/commands/dbcommands.c

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
*
88
*
99
* 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 $
1111
*
1212
*-------------------------------------------------------------------------
1313
*/
@@ -77,20 +77,20 @@ createdb(char *dbname, char *dbpath, int encoding)
7777
" in the server", loc);
7878

7979
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);
8181

8282
sprintf(buf, "%s %s%cbase%ctemplate1%c* %s",
8383
COPY_CMD, DataDir, SEP_CHAR, SEP_CHAR, SEP_CHAR, lp);
8484
system(buf);
8585

8686
#if FALSE
8787
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);",
8989
dbname, user_id, dbname);
9090
#endif
9191

9292
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);
9494

9595

9696
pg_exec_query(buf);
@@ -112,7 +112,7 @@ destroydb(char *dbname)
112112
check_permissions("destroydb", dbpath, dbname, &db_id, &user_id);
113113

114114
if (!OidIsValid(db_id))
115-
elog(FATAL, "impossible: pg_database instance with invalid OID.");
115+
elog(FATAL, "pg_database instance has an invalid OID");
116116

117117
/* stop the vacuum daemon */
118118
stop_vacuum(dbpath, dbname);
@@ -156,7 +156,7 @@ get_pg_dbtup(char *command, char *dbname, Relation dbrel)
156156

157157
scan = heap_beginscan(dbrel, 0, SnapshotNow, 1, &scanKey);
158158
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);
160160

161161
/*
162162
* since we want to return the tuple out of this proc, and we're going
@@ -211,17 +211,17 @@ check_permissions(char *command,
211211
/* Check to make sure user has permission to use createdb */
212212
if (!use_createdb)
213213
{
214-
elog(ERROR, "user \"%s\" is not allowed to create/destroy databases",
214+
elog(ERROR, "user '%s' is not allowed to create/destroy databases",
215215
userName);
216216
}
217217

218218
/* Make sure we are not mucking with the template database */
219219
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);
221221

222222
/* Check to make sure database is not the currently open database */
223223
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);
225225

226226
/* Check to make sure database is owned by this user */
227227

@@ -272,20 +272,20 @@ check_permissions(char *command,
272272
if (dbfound && !strcmp(command, "createdb"))
273273
{
274274

275-
elog(ERROR, "createdb: database %s already exists.", dbname);
275+
elog(ERROR, "createdb: database '%s' already exists", dbname);
276276

277277
}
278278
else if (!dbfound && !strcmp(command, "destroydb"))
279279
{
280280

281-
elog(ERROR, "destroydb: database %s does not exist.", dbname);
281+
elog(ERROR, "destroydb: database '%s' does not exist", dbname);
282282

283283
}
284284
else if (dbfound && !strcmp(command, "destroydb")
285285
&& dbowner != *userIdP && use_super == false)
286286
{
287287

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);
289289

290290
}
291291

@@ -317,7 +317,7 @@ stop_vacuum(char *dbpath, char *dbname)
317317
FreeFile(fp);
318318
if (kill(pid, SIGKILLDAEMON1) < 0)
319319
{
320-
elog(ERROR, "can't kill vacuum daemon (pid %d) on %s",
320+
elog(ERROR, "can't kill vacuum daemon (pid %d) on '%s'",
321321
pid, dbname);
322322
}
323323
}

0 commit comments

Comments
 (0)