1996-10-31 08:10:14 +01:00
|
|
|
/*-------------------------------------------------------------------------
|
|
|
|
*
|
|
|
|
* miscadmin.h--
|
1997-09-07 07:04:48 +02:00
|
|
|
* this file contains general postgres administration and initialization
|
|
|
|
* stuff that used to be spread out between the following files:
|
|
|
|
* globals.h global variables
|
|
|
|
* pdir.h directory path crud
|
|
|
|
* pinit.h postgres initialization
|
|
|
|
* pmod.h processing modes
|
1996-10-31 08:10:14 +01:00
|
|
|
*
|
|
|
|
*
|
|
|
|
* Copyright (c) 1994, Regents of the University of California
|
|
|
|
*
|
1998-07-26 06:31:41 +02:00
|
|
|
* $Id: miscadmin.h,v 1.29 1998/07/26 04:31:23 scrappy Exp $
|
1996-10-31 08:10:14 +01:00
|
|
|
*
|
|
|
|
* NOTES
|
1997-09-07 07:04:48 +02:00
|
|
|
* some of the information in this file will be moved to
|
|
|
|
* other files.
|
1996-10-31 08:10:14 +01:00
|
|
|
*
|
|
|
|
*-------------------------------------------------------------------------
|
|
|
|
*/
|
|
|
|
#ifndef MISCADMIN_H
|
|
|
|
#define MISCADMIN_H
|
|
|
|
|
|
|
|
/*****************************************************************************
|
1997-09-07 07:04:48 +02:00
|
|
|
* globals.h -- *
|
1996-10-31 08:10:14 +01:00
|
|
|
*****************************************************************************/
|
|
|
|
|
|
|
|
/*
|
|
|
|
* from postmaster/postmaster.c
|
|
|
|
*/
|
1997-09-08 04:41:22 +02:00
|
|
|
extern int PostmasterMain(int argc, char *argv[]);
|
1996-10-31 08:10:14 +01:00
|
|
|
|
|
|
|
/*
|
|
|
|
* from utils/init/globals.c
|
|
|
|
*/
|
1997-09-08 04:41:22 +02:00
|
|
|
extern int Portfd;
|
1998-05-19 20:05:58 +02:00
|
|
|
extern bool Noversion;
|
|
|
|
extern bool Quiet;
|
|
|
|
extern bool QueryCancel;
|
1997-09-08 04:41:22 +02:00
|
|
|
extern char *DataDir;
|
1996-10-31 08:10:14 +01:00
|
|
|
|
1998-01-25 06:15:15 +01:00
|
|
|
extern int MyProcPid;
|
|
|
|
|
1998-07-09 05:29:11 +02:00
|
|
|
extern long MyCancelKey;
|
|
|
|
|
1997-09-08 04:41:22 +02:00
|
|
|
extern char OutputFileName[];
|
1996-10-31 08:10:14 +01:00
|
|
|
|
|
|
|
/*
|
|
|
|
* done in storage/backendid.h for now.
|
|
|
|
*
|
|
|
|
* extern BackendId MyBackendId;
|
|
|
|
* extern BackendTag MyBackendTag;
|
|
|
|
*/
|
1997-09-08 04:41:22 +02:00
|
|
|
extern bool MyDatabaseIdIsInitialized;
|
|
|
|
extern Oid MyDatabaseId;
|
|
|
|
extern bool TransactionInitWasProcessed;
|
1996-10-31 08:10:14 +01:00
|
|
|
|
1997-09-08 04:41:22 +02:00
|
|
|
extern bool IsUnderPostmaster;
|
1996-10-31 08:10:14 +01:00
|
|
|
|
1997-09-08 04:41:22 +02:00
|
|
|
extern short DebugLvl;
|
1996-10-31 08:10:14 +01:00
|
|
|
|
1997-03-18 17:36:50 +01:00
|
|
|
/* Date/Time Configuration
|
1997-03-25 09:11:24 +01:00
|
|
|
*
|
|
|
|
* Constants to pass info from runtime environment:
|
1997-09-07 07:04:48 +02:00
|
|
|
* USE_POSTGRES_DATES specifies traditional postgres format for output.
|
|
|
|
* USE_ISO_DATES specifies ISO-compliant format for output.
|
|
|
|
* USE_SQL_DATES specified Oracle/Ingres-compliant format for output.
|
1998-02-26 05:46:47 +01:00
|
|
|
* USE_GERMAN_DATES specifies German-style dd.mm/yyyy date format.
|
1997-03-25 09:11:24 +01:00
|
|
|
*
|
|
|
|
* DateStyle specifies preference for date formatting for output.
|
1997-03-18 17:36:50 +01:00
|
|
|
* EuroDates if client prefers dates interpreted and written w/European conventions.
|
1997-03-25 09:11:24 +01:00
|
|
|
*
|
|
|
|
* HasCTZSet if client timezone is specified by client.
|
|
|
|
* CDayLight is the apparent daylight savings time status.
|
1997-03-18 17:36:50 +01:00
|
|
|
* CTimeZone is the timezone offset in seconds.
|
|
|
|
* CTZName is the timezone label.
|
|
|
|
*/
|
|
|
|
|
1997-09-07 07:04:48 +02:00
|
|
|
#define MAXTZLEN 7
|
1997-03-25 09:11:24 +01:00
|
|
|
|
1997-09-07 07:04:48 +02:00
|
|
|
#define USE_POSTGRES_DATES 0
|
|
|
|
#define USE_ISO_DATES 1
|
|
|
|
#define USE_SQL_DATES 2
|
1997-12-05 00:58:01 +01:00
|
|
|
#define USE_GERMAN_DATES 3
|
1997-03-25 09:11:24 +01:00
|
|
|
|
1997-09-08 04:41:22 +02:00
|
|
|
extern int DateStyle;
|
|
|
|
extern bool EuroDates;
|
|
|
|
extern bool HasCTZSet;
|
|
|
|
extern bool CDayLight;
|
|
|
|
extern int CTimeZone;
|
|
|
|
extern char CTZName[];
|
1997-01-26 16:32:28 +01:00
|
|
|
|
1997-09-08 04:41:22 +02:00
|
|
|
extern char FloatFormat[];
|
|
|
|
extern char DateFormat[];
|
1997-03-18 21:15:39 +01:00
|
|
|
|
1997-09-08 04:41:22 +02:00
|
|
|
extern int fsyncOff;
|
|
|
|
extern int SortMem;
|
1997-08-14 18:11:41 +02:00
|
|
|
|
1997-09-08 04:41:22 +02:00
|
|
|
extern Oid LastOidProcessed; /* for query rewrite */
|
1996-10-31 08:10:14 +01:00
|
|
|
|
|
|
|
#define MAX_PARSE_BUFFER 8192
|
|
|
|
|
1997-09-07 07:04:48 +02:00
|
|
|
/*
|
|
|
|
* default number of buffers in buffer pool
|
|
|
|
*
|
1996-10-31 08:10:14 +01:00
|
|
|
*/
|
|
|
|
#define NDBUFS 64
|
|
|
|
|
|
|
|
/*****************************************************************************
|
1997-09-07 07:04:48 +02:00
|
|
|
* pdir.h -- *
|
|
|
|
* POSTGRES directory path definitions. *
|
1996-10-31 08:10:14 +01:00
|
|
|
*****************************************************************************/
|
|
|
|
|
1998-04-05 23:04:50 +02:00
|
|
|
extern char *DatabaseName;
|
|
|
|
extern char *DatabasePath;
|
|
|
|
|
1997-11-07 07:38:51 +01:00
|
|
|
/* in utils/misc/database.c */
|
1998-07-26 06:31:41 +02:00
|
|
|
#ifdef MULTIBYTE
|
1998-07-24 05:32:46 +02:00
|
|
|
extern void GetRawDatabaseInfo(char *name, Oid *owner, Oid *db_id, char *path, int *encoding);
|
|
|
|
#else
|
1997-11-07 07:38:51 +01:00
|
|
|
extern void GetRawDatabaseInfo(char *name, Oid *owner, Oid *db_id, char *path);
|
1998-07-24 05:32:46 +02:00
|
|
|
#endif
|
1998-02-26 05:46:47 +01:00
|
|
|
extern int GetDatabaseInfo(char *name, Oid *owner, char *path);
|
1997-11-07 07:38:51 +01:00
|
|
|
extern char *ExpandDatabasePath(char *path);
|
|
|
|
|
1996-10-31 08:10:14 +01:00
|
|
|
/* now in utils/init/miscinit.c */
|
1997-09-08 04:41:22 +02:00
|
|
|
extern void SetDatabaseName(char *name);
|
|
|
|
extern void SetDatabasePath(char *path);
|
1998-07-24 05:32:46 +02:00
|
|
|
/* even if MB is not enabled, this function is neccesary
|
|
|
|
* since pg_proc.h does have.
|
|
|
|
*/
|
|
|
|
extern const char *getdatabaseencoding(void);
|
|
|
|
|
1997-09-08 04:41:22 +02:00
|
|
|
extern char *getpgusername(void);
|
|
|
|
extern void SetPgUserName(void);
|
|
|
|
extern Oid GetUserId(void);
|
|
|
|
extern void SetUserId(void);
|
1998-06-09 19:13:06 +02:00
|
|
|
extern int ValidateBinary(char *path);
|
|
|
|
extern int FindExec(char *backend, char *argv0, char *binary_name);
|
1997-09-08 04:41:22 +02:00
|
|
|
extern int CheckPathAccess(char *path, char *name, int open_mode);
|
1996-10-31 08:10:14 +01:00
|
|
|
|
1997-04-27 21:21:06 +02:00
|
|
|
/* lower case version for case-insensitive SQL referenced in pg_proc.h */
|
|
|
|
#define GetPgUserName() getpgusername()
|
1996-10-31 08:10:14 +01:00
|
|
|
|
|
|
|
/*****************************************************************************
|
1997-09-07 07:04:48 +02:00
|
|
|
* pmod.h -- *
|
|
|
|
* POSTGRES processing mode definitions. *
|
1996-10-31 08:10:14 +01:00
|
|
|
*****************************************************************************/
|
|
|
|
/*
|
|
|
|
* Description:
|
1997-09-07 07:04:48 +02:00
|
|
|
* There are four processing modes in POSTGRES. They are NoProcessing
|
1996-10-31 08:10:14 +01:00
|
|
|
* or "none," BootstrapProcessing or "bootstrap," InitProcessing or
|
|
|
|
* "initialization," and NormalProcessing or "normal."
|
|
|
|
*
|
1997-09-07 07:04:48 +02:00
|
|
|
* If a POSTGRES binary is in normal mode, then all code may be executed
|
1996-10-31 08:10:14 +01:00
|
|
|
* normally. In the none mode, only bookkeeping code may be called. In
|
|
|
|
* particular, access method calls may not occur in this mode since the
|
|
|
|
* execution state is outside a transaction.
|
|
|
|
*
|
1997-09-07 07:04:48 +02:00
|
|
|
* The final two processing modes are used during special times. When the
|
1996-10-31 08:10:14 +01:00
|
|
|
* system state indicates bootstrap processing, transactions are all given
|
1997-09-07 07:04:48 +02:00
|
|
|
* transaction id "one" and are consequently guarenteed to commit. This mode
|
1996-10-31 08:10:14 +01:00
|
|
|
* is used during the initial generation of template databases.
|
|
|
|
*
|
|
|
|
* Finally, the execution state is in initialization mode until all normal
|
1997-09-07 07:04:48 +02:00
|
|
|
* initialization is complete. Some code behaves differently when executed in
|
1996-10-31 08:10:14 +01:00
|
|
|
* this mode to enable system bootstrapping.
|
|
|
|
*/
|
|
|
|
|
1997-09-07 07:04:48 +02:00
|
|
|
typedef enum ProcessingMode
|
|
|
|
{
|
|
|
|
NoProcessing, /* "nothing" can be done */
|
|
|
|
BootstrapProcessing, /* bootstrap creation of template database */
|
|
|
|
InitProcessing, /* initializing system */
|
|
|
|
NormalProcessing /* normal processing */
|
1997-09-08 23:56:23 +02:00
|
|
|
} ProcessingMode;
|
1996-10-31 08:10:14 +01:00
|
|
|
|
|
|
|
|
|
|
|
/*****************************************************************************
|
1997-09-07 07:04:48 +02:00
|
|
|
* pinit.h -- *
|
|
|
|
* POSTGRES initialization and cleanup definitions. *
|
1996-10-31 08:10:14 +01:00
|
|
|
*****************************************************************************/
|
|
|
|
/*
|
|
|
|
* Note:
|
1997-09-07 07:04:48 +02:00
|
|
|
* XXX AddExitHandler not defined yet.
|
1996-10-31 08:10:14 +01:00
|
|
|
*/
|
|
|
|
|
1997-09-08 04:41:22 +02:00
|
|
|
typedef int16 ExitStatus;
|
1996-10-31 08:10:14 +01:00
|
|
|
|
1997-09-07 07:04:48 +02:00
|
|
|
#define NormalExitStatus (0)
|
|
|
|
#define FatalExitStatus (127)
|
1996-10-31 08:10:14 +01:00
|
|
|
/* XXX are there any other meaningful exit codes? */
|
|
|
|
|
|
|
|
/* in utils/init/postinit.c */
|
|
|
|
|
1997-09-08 04:41:22 +02:00
|
|
|
extern bool PostgresIsInitialized;
|
1996-10-31 08:10:14 +01:00
|
|
|
|
1997-09-08 04:41:22 +02:00
|
|
|
extern void InitPostgres(char *name);
|
1996-10-31 08:10:14 +01:00
|
|
|
|
|
|
|
/* in miscinit.c */
|
1997-09-08 04:41:22 +02:00
|
|
|
extern void ExitPostgres(ExitStatus status);
|
|
|
|
extern void StatusBackendExit(int status);
|
|
|
|
extern void StatusPostmasterExit(int status);
|
|
|
|
|
|
|
|
extern bool IsNoProcessingMode(void);
|
|
|
|
extern bool IsBootstrapProcessingMode(void);
|
|
|
|
extern bool IsInitProcessingMode(void);
|
|
|
|
extern bool IsNormalProcessingMode(void);
|
|
|
|
extern void SetProcessingMode(ProcessingMode mode);
|
1996-10-31 08:10:14 +01:00
|
|
|
extern ProcessingMode GetProcessingMode(void);
|
|
|
|
|
1997-09-07 07:04:48 +02:00
|
|
|
#endif /* MISCADMIN_H */
|