Commit 46a28f1b authored by Peter Eisentraut's avatar Peter Eisentraut

Fixed everything in and surrounding createdb and dropdb to make it more

error-proof. Rearranged some old code and removed dead sections.
parent bfa3b59d
......@@ -7,7 +7,7 @@
*
*
* IDENTIFICATION
* $Header: /cvsroot/pgsql/src/backend/catalog/aclchk.c,v 1.32 1999/11/24 16:52:31 momjian Exp $
* $Header: /cvsroot/pgsql/src/backend/catalog/aclchk.c,v 1.33 2000/01/13 18:26:04 petere Exp $
*
* NOTES
* See acl.h.
......@@ -358,23 +358,6 @@ pg_aclcheck(char *relname, char *usename, AclMode mode)
usename);
id = (AclId) ((Form_pg_shadow) GETSTRUCT(tuple))->usesysid;
/*
* for the 'pg_database' relation, check the usecreatedb field before
* checking normal permissions
*/
if (strcmp(DatabaseRelationName, relname) == 0 &&
(((Form_pg_shadow) GETSTRUCT(tuple))->usecreatedb))
{
/*
* note that even though the user can now append to the
* pg_database table, there is still additional permissions
* checking in dbcommands.c
*/
if ((mode & ACL_WR) || (mode & ACL_AP))
return ACLCHECK_OK;
}
/*
* Deny anyone permission to update a system catalog unless
* pg_shadow.usecatupd is set. (This is to let superusers protect
......
This diff is collapsed.
......@@ -10,7 +10,7 @@
*
*
* IDENTIFICATION
* $Header: /cvsroot/pgsql/src/backend/parser/gram.y,v 2.123 1999/12/16 17:24:14 momjian Exp $
* $Header: /cvsroot/pgsql/src/backend/parser/gram.y,v 2.124 2000/01/13 18:26:07 petere Exp $
*
* HISTORY
* AUTHOR DATE MAJOR EVENT
......@@ -131,7 +131,8 @@ static Node *doNegate(Node *n);
RuleActionStmtOrEmpty, ConstraintsSetStmt,
CreateGroupStmt, AlterGroupStmt, DropGroupStmt
%type <str> opt_database1, opt_database2, location, encoding
%type <str> createdb_opt_location
%type <ival> createdb_opt_encoding
%type <ival> opt_lock, lock_type
%type <boolean> opt_lmode
......@@ -156,7 +157,7 @@ static Node *doNegate(Node *n);
all_Op, MathOp, opt_name, opt_unique,
OptUseOp, opt_class, SpecialRuleRelation
%type <str> opt_level
%type <str> opt_level, opt_encoding
%type <str> privileges, operation_commalist, grantee
%type <chr> operation, TriggerOneEvent
......@@ -709,7 +710,7 @@ VariableSetStmt: SET ColId TO var_value
n->value = $5;
$$ = (Node *) n;
}
| SET NAMES encoding
| SET NAMES opt_encoding
{
#ifdef MULTIBYTE
VariableSetStmt *n = makeNode(VariableSetStmt);
......@@ -717,7 +718,7 @@ VariableSetStmt: SET ColId TO var_value
n->value = $3;
$$ = (Node *) n;
#else
elog(ERROR, "SET NAMES is not supported");
elog(ERROR, "SET NAMES is not supported.");
#endif
}
;
......@@ -735,6 +736,11 @@ zone_value: Sconst { $$ = $1; }
| LOCAL { $$ = NULL; }
;
opt_encoding: Sconst { $$ = $1; }
| DEFAULT { $$ = NULL; }
| /*EMPTY*/ { $$ = NULL; }
;
VariableShowStmt: SHOW ColId
{
VariableShowStmt *n = makeNode(VariableShowStmt);
......@@ -2508,31 +2514,24 @@ LoadStmt: LOAD file_name
/*****************************************************************************
*
* QUERY:
* createdb dbname
* CREATE DATABASE
*
*
*****************************************************************************/
CreatedbStmt: CREATE DATABASE database_name WITH opt_database1 opt_database2
CreatedbStmt: CREATE DATABASE database_name WITH createdb_opt_location createdb_opt_encoding
{
CreatedbStmt *n = makeNode(CreatedbStmt);
if ($5 == NULL && $6 == NULL) {
elog(ERROR, "CREATE DATABASE WITH requires at least an option");
}
CreatedbStmt *n;
if ($5 == NULL && $6 == -1)
elog(ERROR, "CREATE DATABASE WITH requires at least one option.");
n = makeNode(CreatedbStmt);
n->dbname = $3;
n->dbpath = $5;
#ifdef MULTIBYTE
if ($6 != NULL) {
n->encoding = pg_char_to_encoding($6);
if (n->encoding < 0) {
elog(ERROR, "invalid encoding name %s", $6);
}
} else {
n->encoding = GetTemplateEncoding();
}
n->encoding = $6;
#else
if ($6 != NULL)
elog(ERROR, "WITH ENCODING is not supported");
n->encoding = 0;
#endif
$$ = (Node *)n;
......@@ -2551,28 +2550,57 @@ CreatedbStmt: CREATE DATABASE database_name WITH opt_database1 opt_database2
}
;
opt_database1: LOCATION '=' location { $$ = $3; }
| /*EMPTY*/ { $$ = NULL; }
;
opt_database2: ENCODING '=' encoding { $$ = $3; }
createdb_opt_location: LOCATION '=' Sconst { $$ = $3; }
| LOCATION '=' DEFAULT { $$ = NULL; }
| /*EMPTY*/ { $$ = NULL; }
;
location: Sconst { $$ = $1; }
| DEFAULT { $$ = NULL; }
| /*EMPTY*/ { $$ = NULL; }
createdb_opt_encoding:
ENCODING '=' Sconst
{
#ifdef MULTIBYTE
int i;
i = pg_char_to_encoding($3);
if (i == -1)
elog(ERROR, "%s is not a valid encoding name.", $3);
$$ = i;
#else
elog(ERROR, "WITH ENCODING is not supported.");
#endif
}
| ENCODING '=' Iconst
{
#ifdef MULTIBYTE
if (!pg_get_encent_by_encoding($3))
elog(ERROR, "%d is not a valid encoding code.", $3);
$$ = $3;
#else
elog(ERROR, "WITH ENCODING is not supported.");
#endif
}
| ENCODING '=' DEFAULT
{
#ifdef MULTIBYTE
$$ = GetTemplateEncoding();
#else
$$ = -1;
#endif
}
| /*EMPTY*/
{
#ifdef MULTIBYTE
$$ = GetTemplateEncoding();
#else
$$= -1;
#endif
}
;
encoding: Sconst { $$ = $1; }
| DEFAULT { $$ = NULL; }
| /*EMPTY*/ { $$ = NULL; }
;
/*****************************************************************************
*
* QUERY:
* dropdb dbname
* DROP DATABASE
*
*
*****************************************************************************/
......
......@@ -7,7 +7,7 @@
*
*
* IDENTIFICATION
* $Header: /cvsroot/pgsql/src/backend/storage/smgr/md.c,v 1.61 2000/01/10 06:30:51 inoue Exp $
* $Header: /cvsroot/pgsql/src/backend/storage/smgr/md.c,v 1.62 2000/01/13 18:26:09 petere Exp $
*
*-------------------------------------------------------------------------
*/
......@@ -623,8 +623,6 @@ mdblindwrt(char *dbstr,
/* user table? then put in user database area... */
else if (dbid == MyDatabaseId)
{
extern char *DatabasePath;
path = (char *) palloc(strlen(DatabasePath) + 2 * sizeof(NameData) + 2 + nchars);
if (segno == 0)
sprintf(path, "%s%c%s", DatabasePath, SEP_CHAR, relstr);
......@@ -663,8 +661,6 @@ mdblindwrt(char *dbstr,
/* user table? then put in user database area... */
else if (dbid == MyDatabaseId)
{
extern char *DatabasePath;
path = (char *) palloc(strlen(DatabasePath) + 2 * sizeof(NameData) + 2);
sprintf(path, "%s%c%s", DatabasePath, SEP_CHAR, relstr);
}
......
......@@ -9,7 +9,7 @@
*
*
* IDENTIFICATION
* $Header: /cvsroot/pgsql/src/backend/tcop/utility.c,v 1.76 1999/12/20 01:19:58 tgl Exp $
* $Header: /cvsroot/pgsql/src/backend/tcop/utility.c,v 1.77 2000/01/13 18:26:10 petere Exp $
*
*-------------------------------------------------------------------------
*/
......@@ -592,7 +592,7 @@ ProcessUtility(Node *parsetree,
PS_SET_STATUS(commandTag = "CREATE DATABASE");
CHECK_IF_ABORTED();
createdb(stmt->dbname, stmt->dbpath, stmt->encoding, dest);
createdb(stmt->dbname, stmt->dbpath, stmt->encoding);
}
break;
......@@ -602,7 +602,7 @@ ProcessUtility(Node *parsetree,
PS_SET_STATUS(commandTag = "DROP DATABASE");
CHECK_IF_ABORTED();
dropdb(stmt->dbname, dest);
dropdb(stmt->dbname);
}
break;
......
......@@ -7,10 +7,12 @@
*
*
* IDENTIFICATION
* $Header: /cvsroot/pgsql/src/backend/utils/init/miscinit.c,v 1.38 2000/01/09 12:15:57 ishii Exp $
* $Header: /cvsroot/pgsql/src/backend/utils/init/miscinit.c,v 1.39 2000/01/13 18:26:11 petere Exp $
*
*-------------------------------------------------------------------------
*/
#include "postgres.h"
#include <sys/param.h>
#include <sys/types.h>
#include <signal.h>
......@@ -19,177 +21,21 @@
#include <unistd.h>
#include <grp.h>
#include <pwd.h>
#include <stdlib.h>
#include "postgres.h"
#include "catalog/catname.h"
#include "catalog/pg_shadow.h"
#include "miscadmin.h"
#include "utils/syscache.h"
/*
* EnableAbortEnvVarName
* Enables system abort iff set to a non-empty string in environment.
*/
#define EnableAbortEnvVarName "POSTGRESABORT"
extern char *getenv(const char *name); /* XXX STDLIB */
/* from globals.c */
extern char *UserName;
#ifdef CYR_RECODE
unsigned char RecodeForwTable[128];
unsigned char RecodeBackTable[128];
#endif
/*
* Define USE_ENVIRONMENT to get PGDATA, etc. from environment variables.
* This is the default on UNIX platforms.
*/
#define USE_ENVIRONMENT
/* ----------------------------------------------------------------
* some of the 19 ways to leave postgres
* ----------------------------------------------------------------
*/
/*
* ExitPostgres
* Exit POSTGRES with a status code.
*
* Note:
* This function never returns.
* ...
*
* Side effects:
* ...
*
* Exceptions:
* none
*/
void
ExitPostgres(ExitStatus status)
{
proc_exit(status);
}
/*
* AbortPostgres
* Abort POSTGRES dumping core.
*
* Note:
* This function never returns.
* ...
*
* Side effects:
* Core is dumped iff EnableAbortEnvVarName is set to a non-empty string.
* ...
*
* Exceptions:
* none
*/
#ifdef NOT_USED
void
AbortPostgres()
{
char *abortValue = getenv(EnableAbortEnvVarName);
if (PointerIsValid(abortValue) && abortValue[0] != '\0')
abort();
else
proc_exit(FatalExitStatus);
}
/* ----------------
* StatusBackendExit
* ----------------
*/
void
StatusBackendExit(int status)
{
/* someday, do some real cleanup and then call the LISP exit */
/* someday, call StatusPostmasterExit if running without postmaster */
proc_exit(status);
}
/* ----------------
* StatusPostmasterExit
* ----------------
*/
void
StatusPostmasterExit(int status)
{
/* someday, do some real cleanup and then call the LISP exit */
proc_exit(status);
}
#endif
ProcessingMode Mode = InitProcessing;
/* ----------------------------------------------------------------
* processing mode support stuff (used to be in pmod.c)
* ----------------------------------------------------------------
*/
static ProcessingMode Mode = InitProcessing;
/*
* IsBootstrapProcessingMode
* True iff processing mode is BootstrapProcessing.
*/
bool
IsBootstrapProcessingMode()
{
return (bool) (Mode == BootstrapProcessing);
}
/*
* IsInitProcessingMode
* True iff processing mode is InitProcessing.
*/
bool
IsInitProcessingMode()
{
return (bool) (Mode == InitProcessing);
}
/*
* IsNormalProcessingMode
* True iff processing mode is NormalProcessing.
*/
bool
IsNormalProcessingMode()
{
return (bool) (Mode == NormalProcessing);
}
/*
* SetProcessingMode
* Sets mode of processing as specified.
*
* Exceptions:
* BadArg if called with invalid mode.
*
* Note:
* Mode is InitProcessing before the first time this is called.
*/
void
SetProcessingMode(ProcessingMode mode)
{
AssertArg(mode == BootstrapProcessing || mode == InitProcessing ||
mode == NormalProcessing);
Mode = mode;
}
ProcessingMode
GetProcessingMode()
{
return Mode;
}
/* ----------------------------------------------------------------
* database path / name support stuff
......@@ -197,22 +43,26 @@ GetProcessingMode()
*/
void
SetDatabasePath(char *path)
SetDatabasePath(const char *path)
{
/* use malloc since this is done before memory contexts are set up */
if (DatabasePath)
free(DatabasePath);
DatabasePath = malloc(strlen(path) + 1);
strcpy(DatabasePath, path);
/* use strdup since this is done before memory contexts are set up */
if (path)
{
DatabasePath = strdup(path);
AssertState(DatabasePath);
}
}
void
SetDatabaseName(char *name)
SetDatabaseName(const char *name)
{
if (DatabaseName)
free(DatabaseName);
DatabaseName = malloc(strlen(name) + 1);
strcpy(DatabaseName, name);
if (name)
{
DatabaseName = strdup(name);
AssertState(DatabaseName);
}
}
#ifndef MULTIBYTE
......@@ -431,7 +281,7 @@ static Oid UserId = InvalidOid;
int
GetUserId()
{
Assert(OidIsValid(UserId));
AssertState(OidIsValid(UserId));
return UserId;
}
......@@ -441,7 +291,7 @@ SetUserId()
HeapTuple userTup;
char *userName;
Assert(!OidIsValid(UserId));/* only once */
AssertState(!OidIsValid(UserId));/* only once */
/*
* Don't do scans if we're bootstrapping, none of the system catalogs
......
This diff is collapsed.
......@@ -7,100 +7,43 @@
*
*
* IDENTIFICATION
* $Header: /cvsroot/pgsql/src/backend/utils/misc/Attic/database.c,v 1.33 1999/12/16 22:19:55 wieck Exp $
* $Header: /cvsroot/pgsql/src/backend/utils/misc/Attic/database.c,v 1.34 2000/01/13 18:26:13 petere Exp $
*
*-------------------------------------------------------------------------
*/
#include <unistd.h>
#include <fcntl.h>
#include "postgres.h"
#include <errno.h>
#include <fcntl.h>
#include <stdlib.h>
#include <string.h>
#include <unistd.h>
#include "access/xact.h"
#include "catalog/catname.h"
#include "catalog/pg_database.h"
#include "miscadmin.h"
#include "utils/syscache.h"
#ifdef NOT_USED
/* GetDatabaseInfo()
* Pull database information from pg_database.
*/
int
GetDatabaseInfo(char *name, int4 *owner, char *path)
{
Oid dbowner,
dbid;
char dbpath[MAXPGPATH];
text *dbtext;
Relation dbrel;
HeapTuple dbtup;
HeapTuple tup;
HeapScanDesc scan;
ScanKeyData scanKey;
dbrel = heap_openr(DatabaseRelationName, AccessShareLock);
ScanKeyEntryInitialize(&scanKey, 0, Anum_pg_database_datname,
F_NAMEEQ, NameGetDatum(name));
scan = heap_beginscan(dbrel, 0, SnapshotNow, 1, &scanKey);
if (!HeapScanIsValid(scan))
elog(ERROR, "GetDatabaseInfo: cannot begin scan of %s", DatabaseRelationName);
/*
* Since we're going to close the relation, copy the tuple.
/*
* ExpandDatabasePath resolves a proposed database path (obtained from
* pg_database.datpath) to a full absolute path for further consumption.
* NULL means an error, which the caller should process. One reason for
* such an error would be an absolute alternative path when no absolute
* paths are alllowed.
*/
tup = heap_getnext(scan, 0);
if (HeapTupleIsValid(tup))
dbtup = heap_copytuple(tup);
else
dbtup = tup;
heap_endscan(scan);
if (!HeapTupleIsValid(dbtup))
{
elog(NOTICE, "GetDatabaseInfo: %s entry not found %s",
DatabaseRelationName, name);
heap_close(dbrel, AccessShareLock);
return TRUE;
}
dbowner = (Oid) heap_getattr(dbtup,
Anum_pg_database_datdba,
RelationGetDescr(dbrel),
(char *) NULL);
dbid = dbtup->t_oid;
dbtext = (text *) heap_getattr(dbtup,
Anum_pg_database_datpath,
RelationGetDescr(dbrel),
(char *) NULL);
memcpy(dbpath, VARDATA(dbtext), (VARSIZE(dbtext) - VARHDRSZ));
*(dbpath + (VARSIZE(dbtext) - VARHDRSZ)) = '\0';
heap_close(dbrel, AccessShareLock);
owner = palloc(sizeof(Oid));
*owner = dbowner;
path = pstrdup(dbpath); /* doesn't do the right thing! */
return FALSE;
} /* GetDatabaseInfo() */
#endif
char *
ExpandDatabasePath(char *dbpath)
ExpandDatabasePath(const char *dbpath)
{
char buf[MAXPGPATH];
char *cp;
char *envvar;
const char *cp;
int len;
AssertArg(dbpath);
Assert(DataDir);
if (strlen(dbpath) >= MAXPGPATH)
return NULL; /* ain't gonna fit nohow */
......@@ -120,17 +63,14 @@ ExpandDatabasePath(char *dbpath)
/* path delimiter somewhere? then has leading environment variable */
else if ((cp = strchr(dbpath, SEP_CHAR)) != NULL)
{
const char *envvar;
len = cp - dbpath;
strncpy(buf, dbpath, len);
buf[len] = '\0';
envvar = getenv(buf);
/*
* problem getting environment variable? let calling routine
* handle it
*/
if (envvar == NULL)
return envvar;
return NULL;
snprintf(buf, sizeof(buf), "%s%cbase%c%s",
envvar, SEP_CHAR, SEP_CHAR, (cp + 1));
......@@ -142,10 +82,29 @@ ExpandDatabasePath(char *dbpath)
DataDir, SEP_CHAR, SEP_CHAR, dbpath);
}
/* check for illegal characters in dbpath */
for(cp = buf; *cp; cp++)
{
/* The following characters will not be allowed anywhere in the database
path. (Do not include the slash here.) */
char illegal_dbpath_chars[] =
"\001\002\003\004\005\006\007\010"
"\011\012\013\014\015\016\017\020"
"\021\022\023\024\025\026\027\030"
"\031\032\033\034\035\036\037"
"'.";
const char *cx;
for (cx = illegal_dbpath_chars; *cx; cx++)
if (*cp == *cx)
return NULL;
}
return pstrdup(buf);
} /* ExpandDatabasePath() */
/* --------------------------------
* GetRawDatabaseInfo() -- Find the OID and path of the database.
*
......@@ -161,10 +120,9 @@ ExpandDatabasePath(char *dbpath)
* --------------------------------
*/
void
GetRawDatabaseInfo(char *name, Oid *db_id, char *path)
GetRawDatabaseInfo(const char *name, Oid *db_id, char *path)
{
int dbfd;
int fileflags;
int nbytes;
int max,
i;
......@@ -174,16 +132,15 @@ GetRawDatabaseInfo(char *name, Oid *db_id, char *path)
char *dbfname;
Form_pg_database tup_db;
dbfname = (char *) palloc(strlen(DataDir) + strlen("pg_database") + 2);
sprintf(dbfname, "%s%cpg_database", DataDir, SEP_CHAR);
fileflags = O_RDONLY;
dbfname = (char *) palloc(strlen(DataDir) + strlen(DatabaseRelationName) + 2);
sprintf(dbfname, "%s%c%s", DataDir, SEP_CHAR, DatabaseRelationName);
#ifndef __CYGWIN32__
if ((dbfd = open(dbfname, O_RDONLY, 0)) < 0)
#else
if ((dbfd = open(dbfname, O_RDONLY | O_BINARY, 0)) < 0)
#endif
elog(FATAL, "Cannot open %s", dbfname);
elog(FATAL, "cannot open %s: %s", dbfname, strerror(errno));
pfree(dbfname);
......
......@@ -7,7 +7,7 @@
*
*
* IDENTIFICATION
* $Header: /cvsroot/pgsql/src/backend/utils/mmgr/Attic/palloc.c,v 1.15 1999/10/23 03:13:24 tgl Exp $
* $Header: /cvsroot/pgsql/src/backend/utils/mmgr/Attic/palloc.c,v 1.16 2000/01/13 18:26:14 petere Exp $
*
*-------------------------------------------------------------------------
*/
......@@ -29,7 +29,7 @@
*/
char *
pstrdup(char *string)
pstrdup(const char *string)
{
char *nstr;
int len;
......
......@@ -7,7 +7,7 @@
*
* Copyright (c) 1994, Regents of the University of California
*
* $Id: c.h,v 1.62 1999/12/20 00:51:21 tgl Exp $
* $Id: c.h,v 1.63 2000/01/13 18:26:15 petere Exp $
*
*-------------------------------------------------------------------------
*/
......@@ -767,7 +767,6 @@ extern char *vararg_format(const char *fmt,...);
/* These are for things that are one way on Unix and another on NT */
#define NULL_DEV "/dev/null"
#define COPY_CMD "cp"
#define SEP_CHAR '/'
/* defines for dynamic linking on Win32 platform */
......
......@@ -6,23 +6,14 @@
*
* Copyright (c) 1994, Regents of the University of California
*
* $Id: dbcommands.h,v 1.11 1999/12/10 03:56:06 momjian Exp $
* $Id: dbcommands.h,v 1.12 2000/01/13 18:26:16 petere Exp $
*
*-------------------------------------------------------------------------
*/
#ifndef DBCOMMANDS_H
#define DBCOMMANDS_H
#include <signal.h>
#include "tcop/dest.h"
/*
* Originally from tmp/daemon.h. The functions declared in daemon.h does not
* exist; hence removed. -- AY 7/29/94
*/
#define SIGKILLDAEMON1 SIGTERM
extern void createdb(char *dbname, char *dbpath, int encoding, CommandDest);
extern void dropdb(char *dbname, CommandDest);
extern void createdb(const char *dbname, const char *dbpath, int encoding);
extern void dropdb(const char *dbname);
#endif /* DBCOMMANDS_H */
......@@ -11,7 +11,7 @@
*
* Copyright (c) 1994, Regents of the University of California
*
* $Id: miscadmin.h,v 1.46 2000/01/09 12:19:27 ishii Exp $
* $Id: miscadmin.h,v 1.47 2000/01/13 18:26:15 petere Exp $
*
* NOTES
* some of the information in this file will be moved to
......@@ -47,6 +47,8 @@ extern long MyCancelKey;
extern char OutputFileName[];
extern char *UserName;
/*
* done in storage/backendid.h for now.
*
......@@ -110,13 +112,12 @@ extern char *DatabaseName;
extern char *DatabasePath;
/* in utils/misc/database.c */
extern void GetRawDatabaseInfo(char *name, Oid *db_id, char *path);
extern int GetDatabaseInfo(char *name, int4 *owner, char *path);
extern char *ExpandDatabasePath(char *path);
extern void GetRawDatabaseInfo(const char *name, Oid *db_id, char *path);
extern char *ExpandDatabasePath(const char *path);
/* now in utils/init/miscinit.c */
extern void SetDatabaseName(char *name);
extern void SetDatabasePath(char *path);
extern void SetDatabaseName(const char *name);
extern void SetDatabasePath(const char *path);
/* even if MB is not enabled, this function is neccesary
* since pg_proc.h does have.
......@@ -184,16 +185,27 @@ typedef int16 ExitStatus;
extern bool PostgresIsInitialized;
extern void InitPostgres(char *name);
extern void InitPostgres(const char *dbname);
/* one of the ways to get out of here */
#define ExitPostgres(status) proc_exec(status)
/* processing mode support stuff */
extern ProcessingMode Mode;
#define IsBootstrapProcessingMode() ((bool)(Mode == BootstrapProcessing))
#define IsInitProcessingMode() ((bool)(Mode == InitProcessing))
#define IsNormalProcessingMode() ((bool)(Mode == NormalProcessing))
#define SetProcessingMode(mode) \
do { \
AssertArg(mode == BootstrapProcessing || mode == InitProcessing || \
mode == NormalProcessing); \
Mode = mode; \
} while(0)
/* in miscinit.c */
extern void ExitPostgres(ExitStatus status);
#define GetProcessingMode() Mode
extern bool IsBootstrapProcessingMode(void);
extern bool IsInitProcessingMode(void);
extern bool IsNormalProcessingMode(void);
extern void SetProcessingMode(ProcessingMode mode);
extern ProcessingMode GetProcessingMode(void);
/*
* "postmaster.pid" is a file containing postmaster's pid, being
......
......@@ -6,7 +6,7 @@
*
* Copyright (c) 1994, Regents of the University of California
*
* $Id: elog.h,v 1.13 1999/09/27 15:48:12 vadim Exp $
* $Id: elog.h,v 1.14 2000/01/13 18:26:17 petere Exp $
*
*-------------------------------------------------------------------------
*/
......@@ -22,7 +22,13 @@
#define LOG DEBUG
#define NOIND (-3) /* debug message, don't indent as far */
#ifndef __GNUC__
extern void elog(int lev, const char *fmt, ...);
#else
/* This extension allows gcc to check the format string for consistency with
the supplied arguments. */
extern void elog(int lev, const char *fmt, ...) __attribute__ ((format (printf, 2, 3)));
#endif
#ifndef PG_STANDALONE
extern int DebugFileOpen(void);
......
......@@ -6,7 +6,7 @@
*
* Copyright (c) 1994, Regents of the University of California
*
* $Id: palloc.h,v 1.10 1999/07/14 01:20:30 momjian Exp $
* $Id: palloc.h,v 1.11 2000/01/13 18:26:18 petere Exp $
*
*-------------------------------------------------------------------------
*/
......@@ -32,6 +32,6 @@
#endif /* PALLOC_IS_MALLOC */
/* like strdup except uses palloc */
extern char *pstrdup(char *pointer);
extern char *pstrdup(const char *pointer);
#endif /* PALLOC_H */
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment