mirror of https://github.com/postgres/postgres.git
Remove most compile-time options, add a few runtime options to make up for it.
In particular, no more compiled-in default for PGDATA or LIBDIR. Commands that need them need either invocation options or environment variables. PGPORT default is hardcoded as 5432, but overrideable with options or environment variables.REL2_0B
parent
7ac541daf1
commit
f64b840387
|
|
@ -7,7 +7,7 @@
|
||||||
* Copyright (c) 1994, Regents of the University of California
|
* Copyright (c) 1994, Regents of the University of California
|
||||||
*
|
*
|
||||||
* IDENTIFICATION
|
* IDENTIFICATION
|
||||||
* $Header: /cvsroot/pgsql/src/backend/bootstrap/bootstrap.c,v 1.10 1996/11/10 01:37:48 bryanh Exp $
|
* $Header: /cvsroot/pgsql/src/backend/bootstrap/bootstrap.c,v 1.11 1996/11/14 10:23:34 bryanh Exp $
|
||||||
*
|
*
|
||||||
*-------------------------------------------------------------------------
|
*-------------------------------------------------------------------------
|
||||||
*/
|
*/
|
||||||
|
|
@ -262,21 +262,21 @@ usage(void)
|
||||||
exitpg(1);
|
exitpg(1);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
int
|
||||||
|
BootstrapMain(int argc, char *argv[])
|
||||||
/* ----------------------------------------------------------------
|
/* ----------------------------------------------------------------
|
||||||
* BootstrapMain
|
* The main loop for handling the backend in bootstrap mode
|
||||||
* the main loop for handling the backend in bootstrap mode
|
|
||||||
* the bootstrap mode is used to initialize the template database
|
* the bootstrap mode is used to initialize the template database
|
||||||
* the bootstrap backend doesn't speak SQL, but instead expects
|
* the bootstrap backend doesn't speak SQL, but instead expects
|
||||||
* commands in a special bootstrap language.
|
* commands in a special bootstrap language.
|
||||||
* they are a special bootstrap language.
|
|
||||||
*
|
*
|
||||||
* the arguments passed in to BootstrapMain are the run-time arguments
|
* The arguments passed in to BootstrapMain are the run-time arguments
|
||||||
* without the argument '-boot', the caller is required to have
|
* without the argument '-boot', the caller is required to have
|
||||||
* removed -boot from the run-time args
|
* removed -boot from the run-time args
|
||||||
* ----------------------------------------------------------------
|
* ----------------------------------------------------------------
|
||||||
*/
|
*/
|
||||||
int
|
|
||||||
BootstrapMain(int argc, char *argv[])
|
|
||||||
{
|
{
|
||||||
int i;
|
int i;
|
||||||
int portFd = -1;
|
int portFd = -1;
|
||||||
|
|
@ -302,20 +302,25 @@ BootstrapMain(int argc, char *argv[])
|
||||||
* -------------------
|
* -------------------
|
||||||
*/
|
*/
|
||||||
|
|
||||||
InitGlobals();
|
MasterPid = getpid();
|
||||||
|
|
||||||
/* ----------------
|
/* ----------------
|
||||||
* process command arguments
|
* process command arguments
|
||||||
* ----------------
|
* ----------------
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
/* Set defaults, to be overriden by explicit options below */
|
||||||
Quiet = 0;
|
Quiet = 0;
|
||||||
Noversion = 0;
|
Noversion = 0;
|
||||||
dbName = NULL;
|
dbName = NULL;
|
||||||
|
DataDir = getenv("PGDATA"); /* Null if no PGDATA variable */
|
||||||
|
|
||||||
while ((flag = getopt(argc, argv, "dCOQP:F")) != EOF) {
|
while ((flag = getopt(argc, argv, "D:dCOQP:F")) != EOF) {
|
||||||
switch (flag) {
|
switch (flag) {
|
||||||
|
case 'D':
|
||||||
|
DataDir = optarg;
|
||||||
case 'd':
|
case 'd':
|
||||||
DebugMode = 1; /* print out debuggin info while parsing */
|
DebugMode = 1; /* print out debugging info while parsing */
|
||||||
break;
|
break;
|
||||||
case 'C':
|
case 'C':
|
||||||
Noversion = 1;
|
Noversion = 1;
|
||||||
|
|
@ -345,6 +350,15 @@ BootstrapMain(int argc, char *argv[])
|
||||||
dbName = argv[optind];
|
dbName = argv[optind];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (!DataDir) {
|
||||||
|
fprintf(stderr, "%s does not know where to find the database system "
|
||||||
|
"data. You must specify the directory that contains the "
|
||||||
|
"database system either by specifying the -D invocation "
|
||||||
|
"option or by setting the PGDATA environment variable.\n\n",
|
||||||
|
argv[0]);
|
||||||
|
exitpg(1);
|
||||||
|
}
|
||||||
|
|
||||||
if (dbName == NULL) {
|
if (dbName == NULL) {
|
||||||
dbName = getenv("USER");
|
dbName = getenv("USER");
|
||||||
if (dbName == NULL) {
|
if (dbName == NULL) {
|
||||||
|
|
|
||||||
|
|
@ -4,7 +4,7 @@
|
||||||
# Makefile for libpq subsystem (backend half of libpq interface)
|
# Makefile for libpq subsystem (backend half of libpq interface)
|
||||||
#
|
#
|
||||||
# IDENTIFICATION
|
# IDENTIFICATION
|
||||||
# $Header: /cvsroot/pgsql/src/backend/libpq/Makefile,v 1.3 1996/11/06 08:48:21 scrappy Exp $
|
# $Header: /cvsroot/pgsql/src/backend/libpq/Makefile,v 1.4 1996/11/14 10:23:51 bryanh Exp $
|
||||||
#
|
#
|
||||||
#-------------------------------------------------------------------------
|
#-------------------------------------------------------------------------
|
||||||
|
|
||||||
|
|
@ -16,7 +16,6 @@ INCLUDE_OPT = -I.. \
|
||||||
-I../../include
|
-I../../include
|
||||||
|
|
||||||
CFLAGS+=$(INCLUDE_OPT)
|
CFLAGS+=$(INCLUDE_OPT)
|
||||||
CFLAGS+= -DPOSTPORT='"$(POSTPORT)"'
|
|
||||||
|
|
||||||
# kerberos flags
|
# kerberos flags
|
||||||
ifdef KRBVERS
|
ifdef KRBVERS
|
||||||
|
|
|
||||||
|
|
@ -7,7 +7,7 @@
|
||||||
*
|
*
|
||||||
*
|
*
|
||||||
* IDENTIFICATION
|
* IDENTIFICATION
|
||||||
* $Header: /cvsroot/pgsql/src/backend/libpq/pqcomm.c,v 1.6 1996/11/08 05:56:21 momjian Exp $
|
* $Header: /cvsroot/pgsql/src/backend/libpq/pqcomm.c,v 1.7 1996/11/14 10:23:53 bryanh Exp $
|
||||||
*
|
*
|
||||||
*-------------------------------------------------------------------------
|
*-------------------------------------------------------------------------
|
||||||
*/
|
*/
|
||||||
|
|
@ -140,7 +140,7 @@ pq_getport()
|
||||||
|
|
||||||
if (envport)
|
if (envport)
|
||||||
return(atoi(envport));
|
return(atoi(envport));
|
||||||
return(atoi(POSTPORT));
|
return(atoi(DEF_PGPORT));
|
||||||
}
|
}
|
||||||
|
|
||||||
/* --------------------------------
|
/* --------------------------------
|
||||||
|
|
|
||||||
|
|
@ -30,7 +30,6 @@ struct sembuf
|
||||||
|
|
||||||
#define MAXHOSTNAMELEN 12 /* where is the official definition of this? */
|
#define MAXHOSTNAMELEN 12 /* where is the official definition of this? */
|
||||||
#define MAXPATHLEN _MAX_PATH /* in winsock.h */
|
#define MAXPATHLEN _MAX_PATH /* in winsock.h */
|
||||||
#define POSTPORT "5432"
|
|
||||||
|
|
||||||
/* NT has stricmp not strcasecmp. Which is ANSI? */
|
/* NT has stricmp not strcasecmp. Which is ANSI? */
|
||||||
#define strcasecmp(a,b) _stricmp(a,b)
|
#define strcasecmp(a,b) _stricmp(a,b)
|
||||||
|
|
@ -46,5 +45,3 @@ struct sembuf
|
||||||
#define GETNCNT 5
|
#define GETNCNT 5
|
||||||
#define GETVAL 6
|
#define GETVAL 6
|
||||||
|
|
||||||
#define POSTGRESDIR "d:\\pglite"
|
|
||||||
#define PGDATADIR "d:\\pglite\\data"
|
|
||||||
|
|
|
||||||
|
|
@ -10,7 +10,7 @@
|
||||||
*
|
*
|
||||||
*
|
*
|
||||||
* IDENTIFICATION
|
* IDENTIFICATION
|
||||||
* $Header: /cvsroot/pgsql/src/backend/postmaster/postmaster.c,v 1.24 1996/11/12 06:46:36 bryanh Exp $
|
* $Header: /cvsroot/pgsql/src/backend/postmaster/postmaster.c,v 1.25 1996/11/14 10:24:01 bryanh Exp $
|
||||||
*
|
*
|
||||||
* NOTES
|
* NOTES
|
||||||
*
|
*
|
||||||
|
|
@ -118,7 +118,10 @@ static short ActiveBackends = FALSE;
|
||||||
static int NextBackendId = MAXINT; /* XXX why? */
|
static int NextBackendId = MAXINT; /* XXX why? */
|
||||||
static char *progname = (char *) NULL;
|
static char *progname = (char *) NULL;
|
||||||
|
|
||||||
char *DataDir = (char *) NULL;
|
char *DataDir;
|
||||||
|
/* The PGDATA directory user says to use, or defaults to via environment
|
||||||
|
variable. NULL if no option given and no environment variable set
|
||||||
|
*/
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Default Values
|
* Default Values
|
||||||
|
|
@ -160,7 +163,6 @@ static void CleanupProc(int pid, int exitstatus);
|
||||||
static int DoExec(StartupInfo *packet, int portFd);
|
static int DoExec(StartupInfo *packet, int portFd);
|
||||||
static void ExitPostmaster(int status);
|
static void ExitPostmaster(int status);
|
||||||
static void usage(const char *);
|
static void usage(const char *);
|
||||||
static void checkDataDir(void);
|
|
||||||
int ServerLoop(void);
|
int ServerLoop(void);
|
||||||
int BackendStartup(StartupInfo *packet, Port *port, int *pidPtr);
|
int BackendStartup(StartupInfo *packet, Port *port, int *pidPtr);
|
||||||
static void send_error_reply(Port *port, const char *errormsg);
|
static void send_error_reply(Port *port, const char *errormsg);
|
||||||
|
|
@ -168,6 +170,60 @@ static void send_error_reply(Port *port, const char *errormsg);
|
||||||
extern char *optarg;
|
extern char *optarg;
|
||||||
extern int optind, opterr;
|
extern int optind, opterr;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
static void
|
||||||
|
checkDataDir(const char *DataDir, bool *DataDirOK)
|
||||||
|
{
|
||||||
|
if (DataDir == NULL) {
|
||||||
|
fprintf(stderr, "%s does not know where to find the database system "
|
||||||
|
"data. You must specify the directory that contains the "
|
||||||
|
"database system either by specifying the -D invocation "
|
||||||
|
"option or by setting the PGDATA environment variable.\n\n",
|
||||||
|
progname);
|
||||||
|
*DataDirOK = false;
|
||||||
|
} else {
|
||||||
|
char path[MAXPATHLEN];
|
||||||
|
FILE *fp;
|
||||||
|
|
||||||
|
sprintf(path, "%s%cbase%ctemplate1%cpg_class",
|
||||||
|
DataDir, SEP_CHAR, SEP_CHAR, SEP_CHAR);
|
||||||
|
fp = fopen(path, "r");
|
||||||
|
if (fp == NULL) {
|
||||||
|
fprintf(stderr, "%s does not find the database system. "
|
||||||
|
"Expected to find it "
|
||||||
|
"in the PGDATA directory \"%s\", but unable to open file "
|
||||||
|
"with pathname \"%s\".\n\n",
|
||||||
|
progname, DataDir, path);
|
||||||
|
*DataDirOK = false;
|
||||||
|
} else {
|
||||||
|
char *reason;
|
||||||
|
/* reason ValidatePgVersion failed. NULL if didn't */
|
||||||
|
|
||||||
|
fclose(fp);
|
||||||
|
|
||||||
|
#ifndef WIN32
|
||||||
|
ValidatePgVersion(DataDir, &reason);
|
||||||
|
#else
|
||||||
|
reason = NULL;
|
||||||
|
#endif /* WIN32 */
|
||||||
|
if (reason) {
|
||||||
|
fprintf(stderr,
|
||||||
|
"Database system in directory %s "
|
||||||
|
"is not compatible with this version of "
|
||||||
|
"Postgres, or we are unable to read the "
|
||||||
|
"PG_VERSION file. "
|
||||||
|
"Explanation from ValidatePgVersion: %s\n\n",
|
||||||
|
DataDir, reason);
|
||||||
|
free(reason);
|
||||||
|
*DataDirOK = false;
|
||||||
|
} else *DataDirOK = true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
int
|
int
|
||||||
PostmasterMain(int argc, char *argv[])
|
PostmasterMain(int argc, char *argv[])
|
||||||
{
|
{
|
||||||
|
|
@ -178,12 +234,15 @@ PostmasterMain(int argc, char *argv[])
|
||||||
int status;
|
int status;
|
||||||
int silentflag = 0;
|
int silentflag = 0;
|
||||||
char hostbuf[MAXHOSTNAMELEN];
|
char hostbuf[MAXHOSTNAMELEN];
|
||||||
|
bool DataDirOK; /* We have a usable PGDATA value */
|
||||||
#if defined(WIN32)
|
#if defined(WIN32)
|
||||||
WSADATA WSAData;
|
WSADATA WSAData;
|
||||||
#endif /* WIN32 */
|
#endif /* WIN32 */
|
||||||
|
|
||||||
progname = argv[0];
|
progname = argv[0];
|
||||||
|
|
||||||
|
IsPostmaster = true;
|
||||||
|
|
||||||
/* for security, no dir or file created can be group or other accessible */
|
/* for security, no dir or file created can be group or other accessible */
|
||||||
(void) umask((mode_t) 0077);
|
(void) umask((mode_t) 0077);
|
||||||
|
|
||||||
|
|
@ -193,6 +252,8 @@ PostmasterMain(int argc, char *argv[])
|
||||||
hostName = hostbuf;
|
hostName = hostbuf;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
DataDir = getenv("PGDATA"); /* default value */
|
||||||
|
|
||||||
opterr = 0;
|
opterr = 0;
|
||||||
while ((opt = getopt(argc, argv, "a:B:b:D:dmM:no:p:Ss")) != EOF) {
|
while ((opt = getopt(argc, argv, "a:B:b:D:dmM:no:p:Ss")) != EOF) {
|
||||||
switch (opt) {
|
switch (opt) {
|
||||||
|
|
@ -287,18 +348,11 @@ PostmasterMain(int argc, char *argv[])
|
||||||
if (PostPortName == -1)
|
if (PostPortName == -1)
|
||||||
PostPortName = pq_getport();
|
PostPortName = pq_getport();
|
||||||
|
|
||||||
IsPostmaster = true;
|
checkDataDir(DataDir, &DataDirOK); /* issues error messages */
|
||||||
|
if (!DataDirOK) {
|
||||||
if (!DataDir)
|
fprintf(stderr, "No data directory -- can't proceed.\n");
|
||||||
DataDir = GetPGData();
|
exit(2);
|
||||||
|
}
|
||||||
/*
|
|
||||||
* check whether the data directory exists. Passing this test doesn't
|
|
||||||
* gaurantee we are accessing the right data base but is a first barrier
|
|
||||||
* to site administrators who starts up the postmaster without realizing
|
|
||||||
* it cannot access the data base.
|
|
||||||
*/
|
|
||||||
checkDataDir();
|
|
||||||
|
|
||||||
if (!Execfile[0] && FindBackend(Execfile, argv[0]) < 0) {
|
if (!Execfile[0] && FindBackend(Execfile, argv[0]) < 0) {
|
||||||
fprintf(stderr, "%s: could not find backend to execute...\n",
|
fprintf(stderr, "%s: could not find backend to execute...\n",
|
||||||
|
|
@ -1177,39 +1231,6 @@ dumpstatus(SIGNAL_ARGS)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
|
||||||
checkDataDir(void)
|
|
||||||
{
|
|
||||||
char path[MAXPATHLEN];
|
|
||||||
FILE *fp;
|
|
||||||
|
|
||||||
sprintf(path, "%s%cbase%ctemplate1%cpg_class", DataDir, SEP_CHAR, SEP_CHAR,
|
|
||||||
SEP_CHAR);
|
|
||||||
if ((fp=fopen(path, "r")) == NULL) {
|
|
||||||
fprintf(stderr, "%s does not find the database. Expected to find it "
|
|
||||||
"in the PGDATA directory \"%s\", but unable to open file "
|
|
||||||
"with pathname \"%s\".\n",
|
|
||||||
progname, DataDir, path);
|
|
||||||
exit(2);
|
|
||||||
}
|
|
||||||
fclose(fp);
|
|
||||||
|
|
||||||
#ifndef WIN32
|
|
||||||
{
|
|
||||||
char *reason; /* reason ValidatePgVersion failed. NULL if didn't */
|
|
||||||
ValidatePgVersion(DataDir, &reason);
|
|
||||||
if (reason) {
|
|
||||||
fprintf(stderr,
|
|
||||||
"Database system in directory %s "
|
|
||||||
"is not compatible with this version of "
|
|
||||||
"Postgres, or we are unable to read the PG_VERSION file. "
|
|
||||||
"Explanation from ValidatePgVersion: %s\n",
|
|
||||||
DataDir, reason);
|
|
||||||
free(reason);
|
|
||||||
exit(2);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
#endif /* WIN32 */
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -7,7 +7,7 @@
|
||||||
*
|
*
|
||||||
*
|
*
|
||||||
* IDENTIFICATION
|
* IDENTIFICATION
|
||||||
* $Header: /cvsroot/pgsql/src/backend/tcop/postgres.c,v 1.18 1996/11/11 04:54:51 momjian Exp $
|
* $Header: /cvsroot/pgsql/src/backend/tcop/postgres.c,v 1.19 1996/11/14 10:24:07 bryanh Exp $
|
||||||
*
|
*
|
||||||
* NOTES
|
* NOTES
|
||||||
* this is the "main" module of the postgres backend and
|
* this is the "main" module of the postgres backend and
|
||||||
|
|
@ -177,8 +177,8 @@ int _exec_repeat_ = 1;
|
||||||
* ----------------------------------------------------------------
|
* ----------------------------------------------------------------
|
||||||
*/
|
*/
|
||||||
static char InteractiveBackend(char *inBuf);
|
static char InteractiveBackend(char *inBuf);
|
||||||
static char SocketBackend(char *inBuf, int multiplexedBackend);
|
static char SocketBackend(char *inBuf, bool multiplexedBackend);
|
||||||
static char ReadCommand(char *inBuf, int multiplexedBackend);
|
static char ReadCommand(char *inBuf, bool multiplexedBackend);
|
||||||
|
|
||||||
|
|
||||||
/* ----------------------------------------------------------------
|
/* ----------------------------------------------------------------
|
||||||
|
|
@ -282,7 +282,7 @@ InteractiveBackend(char *inBuf)
|
||||||
*/
|
*/
|
||||||
|
|
||||||
static char
|
static char
|
||||||
SocketBackend(char *inBuf, int multiplexedBackend)
|
SocketBackend(char *inBuf, bool multiplexedBackend)
|
||||||
{
|
{
|
||||||
char qtype[2];
|
char qtype[2];
|
||||||
char result = '\0';
|
char result = '\0';
|
||||||
|
|
@ -353,7 +353,7 @@ SocketBackend(char *inBuf, int multiplexedBackend)
|
||||||
* ----------------
|
* ----------------
|
||||||
*/
|
*/
|
||||||
static char
|
static char
|
||||||
ReadCommand(char *inBuf, int multiplexedBackend)
|
ReadCommand(char *inBuf, bool multiplexedBackend)
|
||||||
{
|
{
|
||||||
if (IsUnderPostmaster || multiplexedBackend)
|
if (IsUnderPostmaster || multiplexedBackend)
|
||||||
return SocketBackend(inBuf, multiplexedBackend);
|
return SocketBackend(inBuf, multiplexedBackend);
|
||||||
|
|
@ -795,7 +795,7 @@ PostgresMain(int argc, char *argv[])
|
||||||
char parser_input[MAX_PARSE_BUFFER];
|
char parser_input[MAX_PARSE_BUFFER];
|
||||||
char *userName;
|
char *userName;
|
||||||
|
|
||||||
int multiplexedBackend = 0;
|
bool multiplexedBackend;
|
||||||
char* hostName; /* the host name of the backend server */
|
char* hostName; /* the host name of the backend server */
|
||||||
char hostbuf[MAXHOSTNAMELEN];
|
char hostbuf[MAXHOSTNAMELEN];
|
||||||
int serverSock;
|
int serverSock;
|
||||||
|
|
@ -838,7 +838,8 @@ PostgresMain(int argc, char *argv[])
|
||||||
* -------------------
|
* -------------------
|
||||||
*/
|
*/
|
||||||
|
|
||||||
InitGlobals();
|
MasterPid = getpid();
|
||||||
|
DataDir = GetPGData();
|
||||||
|
|
||||||
/* ----------------
|
/* ----------------
|
||||||
* parse command line arguments
|
* parse command line arguments
|
||||||
|
|
@ -855,7 +856,11 @@ PostgresMain(int argc, char *argv[])
|
||||||
hostName = hostbuf;
|
hostName = hostbuf;
|
||||||
}
|
}
|
||||||
|
|
||||||
while ((flag = getopt(argc, argv, "B:bCd:Ef:iLm:MNo:P:pQSst:x:F")) != EOF)
|
DataDir = getenv("PGDATA"); /* default */
|
||||||
|
multiplexedBackend = false; /* default */
|
||||||
|
|
||||||
|
while ((flag = getopt(argc, argv, "B:bCD:d:Ef:iLm:MNo:P:pQSst:x:F"))
|
||||||
|
!= EOF)
|
||||||
switch (flag) {
|
switch (flag) {
|
||||||
|
|
||||||
case 'b':
|
case 'b':
|
||||||
|
|
@ -881,12 +886,10 @@ PostgresMain(int argc, char *argv[])
|
||||||
flagC = 1;
|
flagC = 1;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
/* ----------------
|
case 'D': /* PGDATA directory */
|
||||||
* -debug mode
|
DataDir = optarg;
|
||||||
* ----------------
|
|
||||||
*/
|
case 'd': /* debug level */
|
||||||
case 'd':
|
|
||||||
/* DebugMode = true; */
|
|
||||||
flagQ = 0;
|
flagQ = 0;
|
||||||
DebugPrintPlan = true;
|
DebugPrintPlan = true;
|
||||||
DebugPrintParse = true;
|
DebugPrintParse = true;
|
||||||
|
|
@ -954,7 +957,7 @@ PostgresMain(int argc, char *argv[])
|
||||||
are still connected to a single-threaded backend. Requests
|
are still connected to a single-threaded backend. Requests
|
||||||
are FCFS. Everything is in one transaction
|
are FCFS. Everything is in one transaction
|
||||||
*/
|
*/
|
||||||
multiplexedBackend = 1;
|
multiplexedBackend = true;
|
||||||
serverPortnum = atoi(optarg);
|
serverPortnum = atoi(optarg);
|
||||||
#ifdef WIN32
|
#ifdef WIN32
|
||||||
/* There was no postmaster started so the shared memory
|
/* There was no postmaster started so the shared memory
|
||||||
|
|
@ -1118,6 +1121,15 @@ PostgresMain(int argc, char *argv[])
|
||||||
exitpg(1);
|
exitpg(1);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (!DataDir) {
|
||||||
|
fprintf(stderr, "%s does not know where to find the database system "
|
||||||
|
"data. You must specify the directory that contains the "
|
||||||
|
"database system either by specifying the -D invocation "
|
||||||
|
"option or by setting the PGDATA environment variable.\n\n",
|
||||||
|
argv[0]);
|
||||||
|
exitpg(1);
|
||||||
|
}
|
||||||
|
|
||||||
Noversion = flagC;
|
Noversion = flagC;
|
||||||
Quiet = flagQ;
|
Quiet = flagQ;
|
||||||
EchoQuery = flagE;
|
EchoQuery = flagE;
|
||||||
|
|
@ -1257,7 +1269,7 @@ PostgresMain(int argc, char *argv[])
|
||||||
*/
|
*/
|
||||||
if (IsUnderPostmaster == false) {
|
if (IsUnderPostmaster == false) {
|
||||||
puts("\nPOSTGRES backend interactive interface");
|
puts("\nPOSTGRES backend interactive interface");
|
||||||
puts("$Revision: 1.18 $ $Date: 1996/11/11 04:54:51 $");
|
puts("$Revision: 1.19 $ $Date: 1996/11/14 10:24:07 $");
|
||||||
}
|
}
|
||||||
|
|
||||||
/* ----------------
|
/* ----------------
|
||||||
|
|
|
||||||
|
|
@ -7,7 +7,7 @@
|
||||||
*
|
*
|
||||||
*
|
*
|
||||||
* IDENTIFICATION
|
* IDENTIFICATION
|
||||||
* $Header: /cvsroot/pgsql/src/backend/utils/error/elog.c,v 1.10 1996/11/10 03:03:28 momjian Exp $
|
* $Header: /cvsroot/pgsql/src/backend/utils/error/elog.c,v 1.11 1996/11/14 10:24:22 bryanh Exp $
|
||||||
*
|
*
|
||||||
*-------------------------------------------------------------------------
|
*-------------------------------------------------------------------------
|
||||||
*/
|
*/
|
||||||
|
|
@ -234,7 +234,7 @@ DebugFileOpen(void)
|
||||||
fd = fileno(stderr);
|
fd = fileno(stderr);
|
||||||
if (fcntl(fd, F_GETFD, 0) < 0) {
|
if (fcntl(fd, F_GETFD, 0) < 0) {
|
||||||
sprintf(OutputFileName, "%s/pg.errors.%d",
|
sprintf(OutputFileName, "%s/pg.errors.%d",
|
||||||
GetPGData(), (int)getpid());
|
DataDir, (int)getpid());
|
||||||
fd = open(OutputFileName, O_CREAT|O_APPEND|O_WRONLY, 0666);
|
fd = open(OutputFileName, O_CREAT|O_APPEND|O_WRONLY, 0666);
|
||||||
}
|
}
|
||||||
#endif /* WIN32 */
|
#endif /* WIN32 */
|
||||||
|
|
|
||||||
|
|
@ -4,7 +4,7 @@
|
||||||
# Makefile for utils/init
|
# Makefile for utils/init
|
||||||
#
|
#
|
||||||
# IDENTIFICATION
|
# IDENTIFICATION
|
||||||
# $Header: /cvsroot/pgsql/src/backend/utils/init/Makefile,v 1.3 1996/11/12 06:46:40 bryanh Exp $
|
# $Header: /cvsroot/pgsql/src/backend/utils/init/Makefile,v 1.4 1996/11/14 10:24:32 bryanh Exp $
|
||||||
#
|
#
|
||||||
#-------------------------------------------------------------------------
|
#-------------------------------------------------------------------------
|
||||||
|
|
||||||
|
|
@ -16,9 +16,6 @@ INCLUDE_OPT = -I../.. \
|
||||||
-I../../../include
|
-I../../../include
|
||||||
|
|
||||||
CFLAGS += $(INCLUDE_OPT)
|
CFLAGS += $(INCLUDE_OPT)
|
||||||
# The following defines really ought to go in config.h
|
|
||||||
CFLAGS += -DPOSTGRESDIR='"$(POSTGRESDIR)"' -DPGDATADIR='"$(DATADIR)"' \
|
|
||||||
-DPOSTPORT='"$(POSTPORT)"'
|
|
||||||
|
|
||||||
OBJS = enbl.o findbe.o globals.o miscinit.o postinit.o
|
OBJS = enbl.o findbe.o globals.o miscinit.o postinit.o
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -7,7 +7,7 @@
|
||||||
*
|
*
|
||||||
*
|
*
|
||||||
* IDENTIFICATION
|
* IDENTIFICATION
|
||||||
* $Header: /cvsroot/pgsql/src/backend/utils/init/globals.c,v 1.2 1996/11/06 10:31:54 scrappy Exp $
|
* $Header: /cvsroot/pgsql/src/backend/utils/init/globals.c,v 1.3 1996/11/14 10:24:38 bryanh Exp $
|
||||||
*
|
*
|
||||||
* NOTES
|
* NOTES
|
||||||
* Globals used all over the place should be declared here and not
|
* Globals used all over the place should be declared here and not
|
||||||
|
|
@ -99,12 +99,3 @@ char *SharedSystemRelationNames[] = {
|
||||||
VariableRelationName,
|
VariableRelationName,
|
||||||
0
|
0
|
||||||
};
|
};
|
||||||
|
|
||||||
/* set up global variables, pointers, etc. */
|
|
||||||
void InitGlobals()
|
|
||||||
{
|
|
||||||
MasterPid = getpid();
|
|
||||||
DataDir = GetPGData();
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -7,7 +7,7 @@
|
||||||
*
|
*
|
||||||
*
|
*
|
||||||
* IDENTIFICATION
|
* IDENTIFICATION
|
||||||
* $Header: /cvsroot/pgsql/src/backend/utils/init/miscinit.c,v 1.2 1996/11/06 10:31:57 scrappy Exp $
|
* $Header: /cvsroot/pgsql/src/backend/utils/init/miscinit.c,v 1.3 1996/11/14 10:24:41 bryanh Exp $
|
||||||
*
|
*
|
||||||
*-------------------------------------------------------------------------
|
*-------------------------------------------------------------------------
|
||||||
*/
|
*/
|
||||||
|
|
@ -345,35 +345,3 @@ SetUserId()
|
||||||
UserRelationName);
|
UserRelationName);
|
||||||
UserId = (Oid) ((Form_pg_user) GETSTRUCT(userTup))->usesysid;
|
UserId = (Oid) ((Form_pg_user) GETSTRUCT(userTup))->usesysid;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* ----------------
|
|
||||||
* GetPGHome
|
|
||||||
*
|
|
||||||
* Get POSTGRESHOME from environment, or return default.
|
|
||||||
* ----------------
|
|
||||||
*/
|
|
||||||
char *
|
|
||||||
GetPGHome()
|
|
||||||
{
|
|
||||||
#ifdef USE_ENVIRONMENT
|
|
||||||
char *h;
|
|
||||||
|
|
||||||
if ((h = getenv("POSTGRESHOME")) != (char *) NULL)
|
|
||||||
return (h);
|
|
||||||
#endif /* USE_ENVIRONMENT */
|
|
||||||
return (POSTGRESDIR);
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
char *
|
|
||||||
GetPGData()
|
|
||||||
{
|
|
||||||
#ifdef USE_ENVIRONMENT
|
|
||||||
char *p;
|
|
||||||
|
|
||||||
if ((p = getenv("PGDATA")) != (char *) NULL) {
|
|
||||||
return (p);
|
|
||||||
}
|
|
||||||
#endif /* USE_ENVIRONMENT */
|
|
||||||
return (PGDATADIR);
|
|
||||||
}
|
|
||||||
|
|
|
||||||
|
|
@ -7,21 +7,17 @@
|
||||||
#
|
#
|
||||||
#
|
#
|
||||||
# IDENTIFICATION
|
# IDENTIFICATION
|
||||||
# $Header: /cvsroot/pgsql/src/bin/createdb/Attic/Makefile,v 1.2 1996/11/11 13:39:34 bryanh Exp $
|
# $Header: /cvsroot/pgsql/src/bin/createdb/Attic/Makefile,v 1.3 1996/11/14 10:24:45 bryanh Exp $
|
||||||
#
|
#
|
||||||
#-------------------------------------------------------------------------
|
#-------------------------------------------------------------------------
|
||||||
|
|
||||||
SRCDIR= ../..
|
SRCDIR= ../..
|
||||||
include ../../Makefile.global
|
include ../../Makefile.global
|
||||||
|
|
||||||
SEDSCRIPT= \
|
|
||||||
-e "s^_fUnKy_BINDIR_sTuFf_^$(BINDIR)^g" \
|
|
||||||
-e "s^_fUnKy_POSTPORT_sTuFf_^$(POSTPORT)^g"
|
|
||||||
|
|
||||||
all: createdb
|
all: createdb
|
||||||
|
|
||||||
createdb:
|
createdb: createdb.sh
|
||||||
sed $(SEDSCRIPT) <createdb.sh >createdb
|
cp createdb.sh createdb
|
||||||
|
|
||||||
install: createdb
|
install: createdb
|
||||||
$(INSTALL) $(INSTL_EXE_OPTS) $< $(DESTDIR)$(BINDIR)/$<
|
$(INSTALL) $(INSTL_EXE_OPTS) $< $(DESTDIR)$(BINDIR)/$<
|
||||||
|
|
|
||||||
|
|
@ -11,23 +11,10 @@
|
||||||
#
|
#
|
||||||
#
|
#
|
||||||
# IDENTIFICATION
|
# IDENTIFICATION
|
||||||
# $Header: /cvsroot/pgsql/src/bin/createdb/Attic/createdb.sh,v 1.4 1996/09/21 06:24:07 scrappy Exp $
|
# $Header: /cvsroot/pgsql/src/bin/createdb/Attic/createdb.sh,v 1.5 1996/11/14 10:24:46 bryanh Exp $
|
||||||
#
|
#
|
||||||
#-------------------------------------------------------------------------
|
#-------------------------------------------------------------------------
|
||||||
|
|
||||||
# ----------------
|
|
||||||
# Set paths from environment or default values.
|
|
||||||
# The _fUnKy_..._sTuFf_ gets set when the script is installed
|
|
||||||
# from the default value for this build.
|
|
||||||
# Currently the only thing we look for from the environment is
|
|
||||||
# PGDATA, PGHOST, and PGPORT
|
|
||||||
#
|
|
||||||
# ----------------
|
|
||||||
[ -z "$PGPORT" ] && PGPORT=_fUnKy_POSTPORT_sTuFf_
|
|
||||||
[ -z "$PGHOST" ] && PGHOST=localhost
|
|
||||||
BINDIR=_fUnKy_BINDIR_sTuFf_
|
|
||||||
PATH=$BINDIR:$PATH
|
|
||||||
|
|
||||||
CMDNAME=`basename $0`
|
CMDNAME=`basename $0`
|
||||||
|
|
||||||
if [ -z "$USER" ]; then
|
if [ -z "$USER" ]; then
|
||||||
|
|
@ -55,12 +42,29 @@ do
|
||||||
shift;
|
shift;
|
||||||
done
|
done
|
||||||
|
|
||||||
|
if [-z "$AUTHSYS" ]; then
|
||||||
|
AUTHOPT = ""
|
||||||
|
else
|
||||||
AUTHOPT = "-a $AUTHSYS"
|
AUTHOPT = "-a $AUTHSYS"
|
||||||
[ -z "$AUTHSYS" ] && AUTHOPT=""
|
fi
|
||||||
|
|
||||||
psql -tq $AUTHOPT -h $PGHOST -p $PGPORT -c "create database $dbname" template1 || {
|
if [-z "$PGHOST" ]; then
|
||||||
|
PGHOSTOPT = ""
|
||||||
|
else
|
||||||
|
PGHOSTOPT = "-h $PGHOST"
|
||||||
|
fi
|
||||||
|
|
||||||
|
if [-z "$PGPORT" ]; then
|
||||||
|
PGPORTOPT = ""
|
||||||
|
else
|
||||||
|
PGPORTOPT = "-p $PGPORT"
|
||||||
|
fi
|
||||||
|
|
||||||
|
psql -tq $AUTHOPT $PGHOSTOPT $PGPORTOPT -c "create database $dbname" template1
|
||||||
|
|
||||||
|
if [ $? -ne 0 ]
|
||||||
echo "$CMDNAME: database creation failed on $dbname."
|
echo "$CMDNAME: database creation failed on $dbname."
|
||||||
exit 1
|
exit 1
|
||||||
}
|
fi
|
||||||
|
|
||||||
exit 0
|
exit 0
|
||||||
|
|
|
||||||
|
|
@ -7,7 +7,7 @@
|
||||||
#
|
#
|
||||||
#
|
#
|
||||||
# IDENTIFICATION
|
# IDENTIFICATION
|
||||||
# $Header: /cvsroot/pgsql/src/bin/createuser/Attic/Makefile,v 1.2 1996/11/11 13:39:40 bryanh Exp $
|
# $Header: /cvsroot/pgsql/src/bin/createuser/Attic/Makefile,v 1.3 1996/11/14 10:24:48 bryanh Exp $
|
||||||
#
|
#
|
||||||
#-------------------------------------------------------------------------
|
#-------------------------------------------------------------------------
|
||||||
|
|
||||||
|
|
@ -15,14 +15,12 @@ SRCDIR= ../..
|
||||||
include ../../Makefile.global
|
include ../../Makefile.global
|
||||||
|
|
||||||
SEDSCRIPT= \
|
SEDSCRIPT= \
|
||||||
-e "s^_fUnKy_BINDIR_sTuFf_^$(BINDIR)^g" \
|
|
||||||
-e "s^_fUnKy_POSTPORT_sTuFf_^$(POSTPORT)^g" \
|
|
||||||
-e "s^_fUnKy_DASH_N_sTuFf_^$(DASH_N)^g" \
|
-e "s^_fUnKy_DASH_N_sTuFf_^$(DASH_N)^g" \
|
||||||
-e "s^_fUnKy_BACKSLASH_C_sTuFf_^$(BACKSLASH_C)^g"
|
-e "s^_fUnKy_BACKSLASH_C_sTuFf_^$(BACKSLASH_C)^g"
|
||||||
|
|
||||||
all: createuser
|
all: createuser
|
||||||
|
|
||||||
createuser:
|
createuser: createuser.sh
|
||||||
sed $(SEDSCRIPT) <createuser.sh >createuser
|
sed $(SEDSCRIPT) <createuser.sh >createuser
|
||||||
|
|
||||||
install: createuser
|
install: createuser
|
||||||
|
|
|
||||||
|
|
@ -8,25 +8,12 @@
|
||||||
#
|
#
|
||||||
#
|
#
|
||||||
# IDENTIFICATION
|
# IDENTIFICATION
|
||||||
# $Header: /cvsroot/pgsql/src/bin/createuser/Attic/createuser.sh,v 1.5 1996/10/04 20:29:35 scrappy Exp $
|
# $Header: /cvsroot/pgsql/src/bin/createuser/Attic/createuser.sh,v 1.6 1996/11/14 10:24:54 bryanh Exp $
|
||||||
#
|
#
|
||||||
# Note - this should NOT be setuid.
|
# Note - this should NOT be setuid.
|
||||||
#
|
#
|
||||||
#-------------------------------------------------------------------------
|
#-------------------------------------------------------------------------
|
||||||
|
|
||||||
# ----------------
|
|
||||||
# Set paths from environment or default values.
|
|
||||||
# The _fUnKy_..._sTuFf_ gets set when the script is installed
|
|
||||||
# from the default value for this build.
|
|
||||||
# Currently the only thing we look for from the environment is
|
|
||||||
# PGDATA, PGHOST, and PGPORT
|
|
||||||
#
|
|
||||||
# ----------------
|
|
||||||
[ -z "$PGPORT" ] && PGPORT=_fUnKy_POSTPORT_sTuFf_
|
|
||||||
[ -z "$PGHOST" ] && PGHOST=localhost
|
|
||||||
BINDIR=_fUnKy_BINDIR_sTuFf_
|
|
||||||
PATH=$BINDIR:$PATH
|
|
||||||
|
|
||||||
CMDNAME=`basename $0`
|
CMDNAME=`basename $0`
|
||||||
|
|
||||||
if [ -z "$USER" ]; then
|
if [ -z "$USER" ]; then
|
||||||
|
|
@ -52,10 +39,25 @@ do
|
||||||
shift;
|
shift;
|
||||||
done
|
done
|
||||||
|
|
||||||
|
if [-z "$AUTHSYS" ]; then
|
||||||
|
AUTHOPT = ""
|
||||||
|
else
|
||||||
AUTHOPT = "-a $AUTHSYS"
|
AUTHOPT = "-a $AUTHSYS"
|
||||||
[ -z "$AUTHSYS" ] && AUTHOPT=""
|
fi
|
||||||
|
|
||||||
PARGS="-tq $AUTHOPT -h $PGHOST -p $PGPORT"
|
if [-z "$PGHOST" ]; then
|
||||||
|
PGHOSTOPT = ""
|
||||||
|
else
|
||||||
|
PGHOSTOPT = "-h $PGHOST"
|
||||||
|
fi
|
||||||
|
|
||||||
|
if [-z "$PGPORT" ]; then
|
||||||
|
PGPORTOPT = ""
|
||||||
|
else
|
||||||
|
PGPORTOPT = "-p $PGPORT"
|
||||||
|
fi
|
||||||
|
|
||||||
|
PARGS="-tq $AUTHOPT $PGHOSTOPT $PGPORTOPT
|
||||||
|
|
||||||
#
|
#
|
||||||
# generate the first part of the actual monitor command
|
# generate the first part of the actual monitor command
|
||||||
|
|
|
||||||
|
|
@ -7,21 +7,17 @@
|
||||||
#
|
#
|
||||||
#
|
#
|
||||||
# IDENTIFICATION
|
# IDENTIFICATION
|
||||||
# $Header: /cvsroot/pgsql/src/bin/destroydb/Attic/Makefile,v 1.2 1996/11/11 13:39:47 bryanh Exp $
|
# $Header: /cvsroot/pgsql/src/bin/destroydb/Attic/Makefile,v 1.3 1996/11/14 10:25:10 bryanh Exp $
|
||||||
#
|
#
|
||||||
#-------------------------------------------------------------------------
|
#-------------------------------------------------------------------------
|
||||||
|
|
||||||
SRCDIR= ../..
|
SRCDIR= ../..
|
||||||
include ../../Makefile.global
|
include ../../Makefile.global
|
||||||
|
|
||||||
SEDSCRIPT= \
|
|
||||||
-e "s^_fUnKy_BINDIR_sTuFf_^$(BINDIR)^g" \
|
|
||||||
-e "s^_fUnKy_POSTPORT_sTuFf_^$(POSTPORT)^g"
|
|
||||||
|
|
||||||
all: destroydb
|
all: destroydb
|
||||||
|
|
||||||
destroydb:
|
destroydb: destroydb.sh
|
||||||
sed $(SEDSCRIPT) <destroydb.sh >destroydb
|
cp destroydb.sh destroydb
|
||||||
|
|
||||||
install: destroydb
|
install: destroydb
|
||||||
$(INSTALL) $(INSTL_EXE_OPTS) $< $(DESTDIR)$(BINDIR)/$<
|
$(INSTALL) $(INSTL_EXE_OPTS) $< $(DESTDIR)$(BINDIR)/$<
|
||||||
|
|
|
||||||
|
|
@ -11,23 +11,10 @@
|
||||||
#
|
#
|
||||||
#
|
#
|
||||||
# IDENTIFICATION
|
# IDENTIFICATION
|
||||||
# $Header: /cvsroot/pgsql/src/bin/destroydb/Attic/destroydb.sh,v 1.4 1996/09/21 06:24:24 scrappy Exp $
|
# $Header: /cvsroot/pgsql/src/bin/destroydb/Attic/destroydb.sh,v 1.5 1996/11/14 10:25:14 bryanh Exp $
|
||||||
#
|
#
|
||||||
#-------------------------------------------------------------------------
|
#-------------------------------------------------------------------------
|
||||||
|
|
||||||
# ----------------
|
|
||||||
# Set paths from environment or default values.
|
|
||||||
# The _fUnKy_..._sTuFf_ gets set when the script is installed
|
|
||||||
# from the default value for this build.
|
|
||||||
# Currently the only thing we look for from the environment is
|
|
||||||
# PGDATA, PGHOST, and PGPORT
|
|
||||||
#
|
|
||||||
# ----------------
|
|
||||||
[ -z "$PGPORT" ] && PGPORT=_fUnKy_POSTPORT_sTuFf_
|
|
||||||
[ -z "$PGHOST" ] && PGHOST=localhost
|
|
||||||
BINDIR=_fUnKy_BINDIR_sTuFf_
|
|
||||||
PATH=$BINDIR:$PATH
|
|
||||||
|
|
||||||
CMDNAME=`basename $0`
|
CMDNAME=`basename $0`
|
||||||
|
|
||||||
if [ -z "$USER" ]; then
|
if [ -z "$USER" ]; then
|
||||||
|
|
@ -55,10 +42,25 @@ do
|
||||||
shift;
|
shift;
|
||||||
done
|
done
|
||||||
|
|
||||||
|
if [-z "$AUTHSYS" ]; then
|
||||||
|
AUTHOPT = ""
|
||||||
|
else
|
||||||
AUTHOPT = "-a $AUTHSYS"
|
AUTHOPT = "-a $AUTHSYS"
|
||||||
[ -z "$AUTHSYS" ] && AUTHOPT=""
|
fi
|
||||||
|
|
||||||
psql -tq -h $PGHOST -p $PGPORT -c "drop database $dbname" template1
|
if [-z "$PGHOST" ]; then
|
||||||
|
PGHOSTOPT = ""
|
||||||
|
else
|
||||||
|
PGHOSTOPT = "-h $PGHOST"
|
||||||
|
fi
|
||||||
|
|
||||||
|
if [-z "$PGPORT" ]; then
|
||||||
|
PGPORTOPT = ""
|
||||||
|
else
|
||||||
|
PGPORTOPT = "-p $PGPORT"
|
||||||
|
fi
|
||||||
|
|
||||||
|
psql -tq $AUTHOPT $PGHOSTOPT $PGPORTOPT -c "drop database $dbname" template1
|
||||||
|
|
||||||
if [ $? -ne 0 ]
|
if [ $? -ne 0 ]
|
||||||
then
|
then
|
||||||
|
|
|
||||||
|
|
@ -7,7 +7,7 @@
|
||||||
#
|
#
|
||||||
#
|
#
|
||||||
# IDENTIFICATION
|
# IDENTIFICATION
|
||||||
# $Header: /cvsroot/pgsql/src/bin/destroyuser/Attic/Makefile,v 1.2 1996/11/11 13:40:04 bryanh Exp $
|
# $Header: /cvsroot/pgsql/src/bin/destroyuser/Attic/Makefile,v 1.3 1996/11/14 10:25:16 bryanh Exp $
|
||||||
#
|
#
|
||||||
#-------------------------------------------------------------------------
|
#-------------------------------------------------------------------------
|
||||||
|
|
||||||
|
|
@ -15,14 +15,12 @@ SRCDIR= ../..
|
||||||
include ../../Makefile.global
|
include ../../Makefile.global
|
||||||
|
|
||||||
SEDSCRIPT= \
|
SEDSCRIPT= \
|
||||||
-e "s^_fUnKy_BINDIR_sTuFf_^$(BINDIR)^g" \
|
|
||||||
-e "s^_fUnKy_POSTPORT_sTuFf_^$(POSTPORT)^g" \
|
|
||||||
-e "s^_fUnKy_DASH_N_sTuFf_^$(DASH_N)^g" \
|
-e "s^_fUnKy_DASH_N_sTuFf_^$(DASH_N)^g" \
|
||||||
-e "s^_fUnKy_BACKSLASH_C_sTuFf_^$(BACKSLASH_C)^g"
|
-e "s^_fUnKy_BACKSLASH_C_sTuFf_^$(BACKSLASH_C)^g"
|
||||||
|
|
||||||
all: destroyuser
|
all: destroyuser
|
||||||
|
|
||||||
destroyuser:
|
destroyuser: destroyuser.sh
|
||||||
sed $(SEDSCRIPT) <destroyuser.sh >destroyuser
|
sed $(SEDSCRIPT) <destroyuser.sh >destroyuser
|
||||||
|
|
||||||
install: destroyuser
|
install: destroyuser
|
||||||
|
|
|
||||||
|
|
@ -8,25 +8,12 @@
|
||||||
#
|
#
|
||||||
#
|
#
|
||||||
# IDENTIFICATION
|
# IDENTIFICATION
|
||||||
# $Header: /cvsroot/pgsql/src/bin/destroyuser/Attic/destroyuser.sh,v 1.4 1996/09/21 06:24:31 scrappy Exp $
|
# $Header: /cvsroot/pgsql/src/bin/destroyuser/Attic/destroyuser.sh,v 1.5 1996/11/14 10:25:19 bryanh Exp $
|
||||||
#
|
#
|
||||||
# Note - this should NOT be setuid.
|
# Note - this should NOT be setuid.
|
||||||
#
|
#
|
||||||
#-------------------------------------------------------------------------
|
#-------------------------------------------------------------------------
|
||||||
|
|
||||||
# ----------------
|
|
||||||
# Set paths from environment or default values.
|
|
||||||
# The _fUnKy_..._sTuFf_ gets set when the script is installed
|
|
||||||
# from the default value for this build.
|
|
||||||
# Currently the only thing we look for from the environment is
|
|
||||||
# PGDATA, PGHOST, and PGPORT
|
|
||||||
#
|
|
||||||
# ----------------
|
|
||||||
[ -z "$PGPORT" ] && PGPORT=_fUnKy_POSTPORT_sTuFf_
|
|
||||||
[ -z "$PGHOST" ] && PGHOST=localhost
|
|
||||||
BINDIR=_fUnKy_BINDIR_sTuFf_
|
|
||||||
PATH=$BINDIR:$PATH
|
|
||||||
|
|
||||||
CMDNAME=`basename $0`
|
CMDNAME=`basename $0`
|
||||||
|
|
||||||
if [ -z "$USER" ]; then
|
if [ -z "$USER" ]; then
|
||||||
|
|
@ -52,10 +39,25 @@ do
|
||||||
shift;
|
shift;
|
||||||
done
|
done
|
||||||
|
|
||||||
|
if [-z "$AUTHSYS" ]; then
|
||||||
|
AUTHOPT = ""
|
||||||
|
else
|
||||||
AUTHOPT = "-a $AUTHSYS"
|
AUTHOPT = "-a $AUTHSYS"
|
||||||
[ -z "$AUTHSYS" ] && AUTHOPT=""
|
fi
|
||||||
|
|
||||||
PARGS="-tq $AUTHOPT -p $PGPORT -h $PGHOST"
|
if [-z "$PGHOST" ]; then
|
||||||
|
PGHOSTOPT = ""
|
||||||
|
else
|
||||||
|
PGHOSTOPT = "-h $PGHOST"
|
||||||
|
fi
|
||||||
|
|
||||||
|
if [-z "$PGPORT" ]; then
|
||||||
|
PGPORTOPT = ""
|
||||||
|
else
|
||||||
|
PGPORTOPT = "-p $PGPORT"
|
||||||
|
fi
|
||||||
|
|
||||||
|
PARGS="-tq $AUTHOPT $PGHOSTOPT $PGPORTOPT
|
||||||
|
|
||||||
#
|
#
|
||||||
# generate the first part of the actual monitor command
|
# generate the first part of the actual monitor command
|
||||||
|
|
|
||||||
|
|
@ -7,7 +7,7 @@
|
||||||
#
|
#
|
||||||
#
|
#
|
||||||
# IDENTIFICATION
|
# IDENTIFICATION
|
||||||
# $Header: /cvsroot/pgsql/src/bin/initdb/Makefile,v 1.2 1996/11/11 13:40:25 bryanh Exp $
|
# $Header: /cvsroot/pgsql/src/bin/initdb/Makefile,v 1.3 1996/11/14 10:25:22 bryanh Exp $
|
||||||
#
|
#
|
||||||
#-------------------------------------------------------------------------
|
#-------------------------------------------------------------------------
|
||||||
|
|
||||||
|
|
@ -15,16 +15,12 @@ SRCDIR= ../..
|
||||||
include ../../Makefile.global
|
include ../../Makefile.global
|
||||||
|
|
||||||
SEDSCRIPT= \
|
SEDSCRIPT= \
|
||||||
-e "s^_fUnKy_BINDIR_sTuFf_^$(BINDIR)^g" \
|
|
||||||
-e "s^_fUnKy_LIBDIR_sTuFf_^$(LIBDIR)^g" \
|
|
||||||
-e "s^_fUnKy_DATADIR_sTuFf_^$(DATADIR)^g" \
|
|
||||||
-e "s^_fUnKy_NAMEDATALEN_sTuFf_^$(NAMEDATALEN)^g" \
|
-e "s^_fUnKy_NAMEDATALEN_sTuFf_^$(NAMEDATALEN)^g" \
|
||||||
-e "s^_fUnKy_OIDNAMELEN_sTuFf_^$(OIDNAMELEN)^g" \
|
-e "s^_fUnKy_OIDNAMELEN_sTuFf_^$(OIDNAMELEN)^g"
|
||||||
-e "s^_fUnKy_POSTPORT_sTuFf_^$(POSTPORT)^g"
|
|
||||||
|
|
||||||
all: initdb
|
all: initdb
|
||||||
|
|
||||||
initdb:
|
initdb: initdb.sh
|
||||||
sed $(SEDSCRIPT) <initdb.sh >initdb
|
sed $(SEDSCRIPT) <initdb.sh >initdb
|
||||||
|
|
||||||
install: initdb
|
install: initdb
|
||||||
|
|
|
||||||
|
|
@ -26,31 +26,32 @@
|
||||||
#
|
#
|
||||||
#
|
#
|
||||||
# IDENTIFICATION
|
# IDENTIFICATION
|
||||||
# $Header: /cvsroot/pgsql/src/bin/initdb/Attic/initdb.sh,v 1.12 1996/10/12 07:49:56 bryanh Exp $
|
# $Header: /cvsroot/pgsql/src/bin/initdb/Attic/initdb.sh,v 1.13 1996/11/14 10:25:33 bryanh Exp $
|
||||||
#
|
#
|
||||||
#-------------------------------------------------------------------------
|
#-------------------------------------------------------------------------
|
||||||
|
|
||||||
# ----------------
|
# ----------------
|
||||||
# Set paths from environment or default values.
|
|
||||||
# The _fUnKy_..._sTuFf_ gets set when the script is built (with make)
|
# The _fUnKy_..._sTuFf_ gets set when the script is built (with make)
|
||||||
# from parameters set in the make file.
|
# from parameters set in the make file.
|
||||||
# Currently the only thing we look for from the environment is
|
|
||||||
# PGDATA, PGHOST, and PGPORT. However, we should have environment
|
|
||||||
# variables for all the paths.
|
|
||||||
#
|
#
|
||||||
# ----------------
|
# ----------------
|
||||||
[ -z "$PGDATA" ] && { PGDATA=_fUnKy_DATADIR_sTuFf_; export PGDATA; }
|
|
||||||
[ -z "$PGPORT" ] && { PGPORT=_fUnKy_POSTPORT_sTuFf_; export PGPORT; }
|
|
||||||
[ -z "$PGHOST" ] && { PGHOST=localhost; export PGHOST; }
|
|
||||||
BINDIR=_fUnKy_BINDIR_sTuFf_
|
|
||||||
LIBDIR=_fUnKy_LIBDIR_sTuFf_
|
|
||||||
NAMEDATALEN=_fUnKy_NAMEDATALEN_sTuFf_
|
NAMEDATALEN=_fUnKy_NAMEDATALEN_sTuFf_
|
||||||
OIDNAMELEN=_fUnKy_OIDNAMELEN_sTuFf_
|
OIDNAMELEN=_fUnKy_OIDNAMELEN_sTuFf_
|
||||||
PATH=$BINDIR:$PATH
|
|
||||||
export PATH
|
|
||||||
|
|
||||||
CMDNAME=`basename $0`
|
CMDNAME=`basename $0`
|
||||||
|
|
||||||
|
# Find the default PGLIB directory (the directory that contains miscellaneous
|
||||||
|
# files that are part of Postgres). The user-written program postconfig
|
||||||
|
# outputs variable settings like "PGLIB=/usr/lib/whatever". If it doesn't
|
||||||
|
# output a PGLIB value, then there is no default and the user must
|
||||||
|
# specify the pglib option. Postconfig may not exist, in which case
|
||||||
|
# our invocation of it silently fails.
|
||||||
|
|
||||||
|
# The x=x below is to satisfy export if postconfig returns nothing.
|
||||||
|
|
||||||
|
export x=x $(postconfig 2>/dev/null)
|
||||||
|
|
||||||
# Set defaults:
|
# Set defaults:
|
||||||
debug=0
|
debug=0
|
||||||
noclean=0
|
noclean=0
|
||||||
|
|
@ -68,7 +69,8 @@ do
|
||||||
;;
|
;;
|
||||||
--noclean|-n)
|
--noclean|-n)
|
||||||
noclean=1
|
noclean=1
|
||||||
echo "Running with noclean mode on. Mistakes will not be cleaned up."
|
echo "Running with noclean mode on. "
|
||||||
|
"Mistakes will not be cleaned up."
|
||||||
;;
|
;;
|
||||||
--template|-t)
|
--template|-t)
|
||||||
template_only=1
|
template_only=1
|
||||||
|
|
@ -94,10 +96,24 @@ do
|
||||||
-r*)
|
-r*)
|
||||||
PGDATA="`echo $1 | sed s/^-r//`"
|
PGDATA="`echo $1 | sed s/^-r//`"
|
||||||
;;
|
;;
|
||||||
|
--pglib=*)
|
||||||
|
PGLIB="`echo $1 | sed s/^--pglib=//`"
|
||||||
|
;;
|
||||||
|
-l)
|
||||||
|
shift
|
||||||
|
PGLIB="$1"
|
||||||
|
;;
|
||||||
|
-l*)
|
||||||
|
PGLIB="`echo $1 | sed s/^-l//`"
|
||||||
|
;;
|
||||||
|
|
||||||
*)
|
*)
|
||||||
echo "Unrecognized option '$1'. Syntax is:"
|
echo "Unrecognized option '$1'. Syntax is:"
|
||||||
echo "initdb [-t | --template] [-d | --debug] [-n | --noclean]" \
|
echo "initdb [-t | --template] [-d | --debug]" \
|
||||||
"[-u SUPERUSER | --username=SUPERUSER] [-r DATADIR | --pgdata=DATADIR]"
|
"[-n | --noclean]" \
|
||||||
|
"[-u SUPERUSER | --username=SUPERUSER]" \
|
||||||
|
"[-r DATADIR | --pgdata=DATADIR]" \
|
||||||
|
"[-l LIBDIR | --pglib=LIBDIR]"
|
||||||
exit 100
|
exit 100
|
||||||
esac
|
esac
|
||||||
shift
|
shift
|
||||||
|
|
@ -109,9 +125,34 @@ else
|
||||||
BACKENDARGS="-boot -C -F -Q"
|
BACKENDARGS="-boot -C -F -Q"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
TEMPLATE=$LIBDIR/local1_template1.bki.source
|
TEMPLATE=$PGLIB/local1_template1.bki.source
|
||||||
GLOBAL=$LIBDIR/global1.bki.source
|
GLOBAL=$PGLIB/global1.bki.source
|
||||||
PG_HBA_SAMPLE=$LIBDIR/pg_hba.conf.sample
|
PG_HBA_SAMPLE=$PGLIB/pg_hba.conf.sample
|
||||||
|
|
||||||
|
#-------------------------------------------------------------------------
|
||||||
|
# Make sure he told us where to find the Postgres files.
|
||||||
|
#-------------------------------------------------------------------------
|
||||||
|
if [ -z $PGLIB ]; then
|
||||||
|
echo "$CMDNAME does not know where to find the files that make up "
|
||||||
|
echo "Postgres (the PGLIB directory). You must identify the PGLIB "
|
||||||
|
echo "directory either with a --pglib invocation option, or by "
|
||||||
|
echo "setting the PGLIB environment variable, or by having a program "
|
||||||
|
echo "called 'postconfig' in your search path that sets the PGLIB "
|
||||||
|
echo "environment variable."
|
||||||
|
exit 20
|
||||||
|
fi
|
||||||
|
|
||||||
|
#-------------------------------------------------------------------------
|
||||||
|
# Make sure he told us where to build the database system
|
||||||
|
#-------------------------------------------------------------------------
|
||||||
|
|
||||||
|
if [ -z $PGDATA ]; then
|
||||||
|
echo "$CMDNAME: You must identify the PGDATA directory, where the data"
|
||||||
|
echo "for this database system will reside. Do this with either a"
|
||||||
|
echo "--pgdata invocation option or a PGDATA environment variable."
|
||||||
|
echo
|
||||||
|
exit 20
|
||||||
|
fi
|
||||||
|
|
||||||
#-------------------------------------------------------------------------
|
#-------------------------------------------------------------------------
|
||||||
# Find the input files
|
# Find the input files
|
||||||
|
|
@ -120,7 +161,9 @@ PG_HBA_SAMPLE=$LIBDIR/pg_hba.conf.sample
|
||||||
for PREREQ_FILE in $TEMPLATE $GLOBAL $PG_HBA_SAMPLE; do
|
for PREREQ_FILE in $TEMPLATE $GLOBAL $PG_HBA_SAMPLE; do
|
||||||
if [ ! -f $PREREQ_FILE ]; then
|
if [ ! -f $PREREQ_FILE ]; then
|
||||||
echo "$CMDNAME does not find the file '$PREREQ_FILE'."
|
echo "$CMDNAME does not find the file '$PREREQ_FILE'."
|
||||||
echo "This means Postgres95 is incorrectly installed."
|
echo "This means you have identified an invalid PGLIB directory."
|
||||||
|
echo "You specify a PGLIB directory with a --pglib invocation "
|
||||||
|
echo "option, a PGLIB environment variable, or a postconfig program."
|
||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
done
|
done
|
||||||
|
|
@ -157,15 +200,13 @@ fi
|
||||||
if [ $POSTGRES_SUPERUID -ne `pg_id` -a `pg_id` -ne 0 ]; then
|
if [ $POSTGRES_SUPERUID -ne `pg_id` -a `pg_id` -ne 0 ]; then
|
||||||
echo "Only the unix superuser may initialize a database with a different"
|
echo "Only the unix superuser may initialize a database with a different"
|
||||||
echo "Postgres superuser. (You must be able to create files that belong"
|
echo "Postgres superuser. (You must be able to create files that belong"
|
||||||
echo "to the specified Postgres userid)."
|
echo "to the specified unix user)."
|
||||||
exit 2
|
exit 2
|
||||||
fi
|
fi
|
||||||
|
|
||||||
echo "We are initializing the database system with username" \
|
echo "We are initializing the database system with username" \
|
||||||
"$POSTGRES_SUPERUSERNAME (uid=$POSTGRES_SUPERUID)."
|
"$POSTGRES_SUPERUSERNAME (uid=$POSTGRES_SUPERUID)."
|
||||||
echo "Please be aware that Postgres is not secure. Anyone who can connect"
|
echo "This user will own all the files and must also own the server process."
|
||||||
echo "to the database can act as user $POSTGRES_SUPERUSERNAME" \
|
|
||||||
"with very little effort."
|
|
||||||
echo
|
echo
|
||||||
|
|
||||||
# -----------------------------------------------------------------------
|
# -----------------------------------------------------------------------
|
||||||
|
|
@ -182,8 +223,8 @@ if [ -d "$PGDATA" ]; then
|
||||||
echo "database system already exists."
|
echo "database system already exists."
|
||||||
echo
|
echo
|
||||||
echo "If you want to create a new database system, either remove "
|
echo "If you want to create a new database system, either remove "
|
||||||
echo "the $PGDATA directory or run initdb with environment variable"
|
echo "the $PGDATA directory or run initdb with a --pgdata option "
|
||||||
echo "PGDATA set to something other than $PGDATA."
|
echo "other than $PGDATA."
|
||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
else
|
else
|
||||||
|
|
|
||||||
|
|
@ -159,6 +159,14 @@
|
||||||
/* OIDNAMELEN should be set to NAMEDATALEN + sizeof(Oid) */
|
/* OIDNAMELEN should be set to NAMEDATALEN + sizeof(Oid) */
|
||||||
#define OIDNAMELEN 36
|
#define OIDNAMELEN 36
|
||||||
|
|
||||||
|
/*
|
||||||
|
* DEF_PGPORT is the TCP port number on which the Postmaster listens by
|
||||||
|
* default. This can be overriden by command options, environment variables,
|
||||||
|
* and the postconfig hook.
|
||||||
|
*/
|
||||||
|
|
||||||
|
#define DEF_PGPORT "5432"
|
||||||
|
|
||||||
/* turn this on if you prefer European style dates instead of American
|
/* turn this on if you prefer European style dates instead of American
|
||||||
* style dates
|
* style dates
|
||||||
*/
|
*/
|
||||||
|
|
|
||||||
|
|
@ -4,7 +4,6 @@
|
||||||
* this file contains general postgres administration and initialization
|
* this file contains general postgres administration and initialization
|
||||||
* stuff that used to be spread out between the following files:
|
* stuff that used to be spread out between the following files:
|
||||||
* globals.h global variables
|
* globals.h global variables
|
||||||
* magic.h PG_RELEASE, PG_VERSION, etc defines
|
|
||||||
* pdir.h directory path crud
|
* pdir.h directory path crud
|
||||||
* pinit.h postgres initialization
|
* pinit.h postgres initialization
|
||||||
* pmod.h processing modes
|
* pmod.h processing modes
|
||||||
|
|
@ -12,7 +11,7 @@
|
||||||
*
|
*
|
||||||
* Copyright (c) 1994, Regents of the University of California
|
* Copyright (c) 1994, Regents of the University of California
|
||||||
*
|
*
|
||||||
* $Id: miscadmin.h,v 1.3 1996/11/12 06:47:10 bryanh Exp $
|
* $Id: miscadmin.h,v 1.4 1996/11/14 10:25:42 bryanh Exp $
|
||||||
*
|
*
|
||||||
* NOTES
|
* NOTES
|
||||||
* some of the information in this file will be moved to
|
* some of the information in this file will be moved to
|
||||||
|
|
@ -36,13 +35,12 @@ extern int PostmasterMain(int argc, char* argv[]);
|
||||||
* from utils/init/globals.c
|
* from utils/init/globals.c
|
||||||
*/
|
*/
|
||||||
extern int Portfd;
|
extern int Portfd;
|
||||||
extern int Noversion; /* moved from magic.c */
|
extern int Noversion;
|
||||||
extern int MasterPid; /* declared and defined in utils/initglobals.c */
|
extern int MasterPid;
|
||||||
extern int Quiet;
|
extern int Quiet;
|
||||||
extern char *DataDir;
|
extern char *DataDir;
|
||||||
|
|
||||||
extern char OutputFileName[];
|
extern char OutputFileName[];
|
||||||
extern void InitGlobals(void);
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* done in storage/backendid.h for now.
|
* done in storage/backendid.h for now.
|
||||||
|
|
@ -83,8 +81,6 @@ extern char *GetPgUserName(void);
|
||||||
extern void SetPgUserName(void);
|
extern void SetPgUserName(void);
|
||||||
extern Oid GetUserId(void);
|
extern Oid GetUserId(void);
|
||||||
extern void SetUserId(void);
|
extern void SetUserId(void);
|
||||||
extern char *GetPGHome(void);
|
|
||||||
extern char *GetPGData(void);
|
|
||||||
extern int ValidateBackend(char *path);
|
extern int ValidateBackend(char *path);
|
||||||
extern int FindBackend(char *backend, char *argv0);
|
extern int FindBackend(char *backend, char *argv0);
|
||||||
extern int CheckPathAccess(char *path, char *name, int open_mode);
|
extern int CheckPathAccess(char *path, char *name, int open_mode);
|
||||||
|
|
|
||||||
|
|
@ -7,7 +7,7 @@
|
||||||
#
|
#
|
||||||
#
|
#
|
||||||
# IDENTIFICATION
|
# IDENTIFICATION
|
||||||
# $Header: /cvsroot/pgsql/src/interfaces/libpq++/Attic/Makefile,v 1.3 1996/11/13 10:35:39 bryanh Exp $
|
# $Header: /cvsroot/pgsql/src/interfaces/libpq++/Attic/Makefile,v 1.4 1996/11/14 10:25:54 bryanh Exp $
|
||||||
#
|
#
|
||||||
#-------------------------------------------------------------------------
|
#-------------------------------------------------------------------------
|
||||||
|
|
||||||
|
|
@ -21,7 +21,7 @@ INCLUDE_OPT= \
|
||||||
-I../include \
|
-I../include \
|
||||||
-I$(LIBPQDIR)
|
-I$(LIBPQDIR)
|
||||||
|
|
||||||
CXXFLAGS+= $(INCLUDE_OPT) -DPOSTPORT='"$(POSTPORT)"'
|
CXXFLAGS+= $(INCLUDE_OPT)
|
||||||
|
|
||||||
ifdef KRBVERS
|
ifdef KRBVERS
|
||||||
CXXFLAGS+= $(KRBFLAGS)
|
CXXFLAGS+= $(KRBFLAGS)
|
||||||
|
|
|
||||||
|
|
@ -7,7 +7,7 @@
|
||||||
#
|
#
|
||||||
#
|
#
|
||||||
# IDENTIFICATION
|
# IDENTIFICATION
|
||||||
# $Header: /cvsroot/pgsql/src/interfaces/libpq/Makefile,v 1.16 1996/11/12 11:42:21 bryanh Exp $
|
# $Header: /cvsroot/pgsql/src/interfaces/libpq/Makefile,v 1.17 1996/11/14 10:25:48 bryanh Exp $
|
||||||
#
|
#
|
||||||
#-------------------------------------------------------------------------
|
#-------------------------------------------------------------------------
|
||||||
|
|
||||||
|
|
@ -17,7 +17,7 @@ include ../Makefile.global
|
||||||
# We need the backend directory here for its fmgr.h
|
# We need the backend directory here for its fmgr.h
|
||||||
INCLUDE_OPT= -I../include -I../backend
|
INCLUDE_OPT= -I../include -I../backend
|
||||||
|
|
||||||
CFLAGS+= $(INCLUDE_OPT) -DPOSTPORT='"$(POSTPORT)"'
|
CFLAGS+= $(INCLUDE_OPT)
|
||||||
|
|
||||||
ifdef KRBVERS
|
ifdef KRBVERS
|
||||||
CFLAGS+= $(KRBFLAGS)
|
CFLAGS+= $(KRBFLAGS)
|
||||||
|
|
|
||||||
|
|
@ -7,7 +7,7 @@
|
||||||
*
|
*
|
||||||
*
|
*
|
||||||
* IDENTIFICATION
|
* IDENTIFICATION
|
||||||
* $Header: /cvsroot/pgsql/src/interfaces/libpq/fe-connect.c,v 1.18 1996/11/11 12:16:54 scrappy Exp $
|
* $Header: /cvsroot/pgsql/src/interfaces/libpq/fe-connect.c,v 1.19 1996/11/14 10:25:50 bryanh Exp $
|
||||||
*
|
*
|
||||||
*-------------------------------------------------------------------------
|
*-------------------------------------------------------------------------
|
||||||
*/
|
*/
|
||||||
|
|
@ -63,7 +63,7 @@ static void conninfo_free(void);
|
||||||
|
|
||||||
|
|
||||||
/* ----------
|
/* ----------
|
||||||
* Definition of the conninfo parametes and their fallback resources.
|
* Definition of the conninfo parameters and their fallback resources.
|
||||||
* If Environment-Var and Compiled-in are specified as NULL, no
|
* If Environment-Var and Compiled-in are specified as NULL, no
|
||||||
* fallback is available. If after all no value can be determined
|
* fallback is available. If after all no value can be determined
|
||||||
* for an option, an error is returned.
|
* for an option, an error is returned.
|
||||||
|
|
@ -93,7 +93,7 @@ static PQconninfoOption PQconninfoOptions[] = {
|
||||||
{ "host", "PGHOST", DefaultHost, NULL,
|
{ "host", "PGHOST", DefaultHost, NULL,
|
||||||
"Database-Host", "", 40 },
|
"Database-Host", "", 40 },
|
||||||
|
|
||||||
{ "port", "PGPORT", POSTPORT, NULL,
|
{ "port", "PGPORT", DEF_PGPORT, NULL,
|
||||||
"Database-Port", "", 6 },
|
"Database-Port", "", 6 },
|
||||||
|
|
||||||
{ "tty", "PGTTY", DefaultTty, NULL,
|
{ "tty", "PGTTY", DefaultTty, NULL,
|
||||||
|
|
@ -192,7 +192,6 @@ PQconnectdb(const char *conninfo)
|
||||||
conn->Pfdebug = NULL;
|
conn->Pfdebug = NULL;
|
||||||
conn->port = NULL;
|
conn->port = NULL;
|
||||||
conn->notifyList = DLNewList();
|
conn->notifyList = DLNewList();
|
||||||
conn->lobjfuncs = NULL;
|
|
||||||
|
|
||||||
conn->pghost = strdup(conninfo_getval("host"));
|
conn->pghost = strdup(conninfo_getval("host"));
|
||||||
conn->pgport = strdup(conninfo_getval("port"));
|
conn->pgport = strdup(conninfo_getval("port"));
|
||||||
|
|
@ -300,7 +299,6 @@ PQsetdb(const char *pghost, const char* pgport, const char* pgoptions, const cha
|
||||||
conn->Pfdebug = NULL;
|
conn->Pfdebug = NULL;
|
||||||
conn->port = NULL;
|
conn->port = NULL;
|
||||||
conn->notifyList = DLNewList();
|
conn->notifyList = DLNewList();
|
||||||
conn->lobjfuncs = NULL;
|
|
||||||
|
|
||||||
if (!pghost || pghost[0] == '\0') {
|
if (!pghost || pghost[0] == '\0') {
|
||||||
if (!(tmp = getenv("PGHOST"))) {
|
if (!(tmp = getenv("PGHOST"))) {
|
||||||
|
|
@ -312,7 +310,7 @@ PQsetdb(const char *pghost, const char* pgport, const char* pgoptions, const cha
|
||||||
|
|
||||||
if (!pgport || pgport[0] == '\0') {
|
if (!pgport || pgport[0] == '\0') {
|
||||||
if (!(tmp = getenv("PGPORT"))) {
|
if (!(tmp = getenv("PGPORT"))) {
|
||||||
tmp = POSTPORT;
|
tmp = DEF_PGPORT;
|
||||||
}
|
}
|
||||||
conn->pgport = strdup(tmp);
|
conn->pgport = strdup(tmp);
|
||||||
} else
|
} else
|
||||||
|
|
@ -521,7 +519,6 @@ freePGconn(PGconn *conn)
|
||||||
if (conn->dbName) free(conn->dbName);
|
if (conn->dbName) free(conn->dbName);
|
||||||
if (conn->pguser) free(conn->pguser);
|
if (conn->pguser) free(conn->pguser);
|
||||||
if (conn->notifyList) DLFreeList(conn->notifyList);
|
if (conn->notifyList) DLFreeList(conn->notifyList);
|
||||||
if (conn->lobjfuncs) free(conn->lobjfuncs);
|
|
||||||
free(conn);
|
free(conn);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue