Bring in a patch from Keith Parks to move the use of European dates
from a #define to a run-time option '-e' Man page was updated to reflect new option
This commit is contained in:
parent
ac3c926c42
commit
632c44d829
@ -19,6 +19,8 @@
|
||||
#include <time.h>
|
||||
|
||||
#include <config.h>
|
||||
#include <postgres.h>
|
||||
#include <miscadmin.h>
|
||||
#include <parser/sysfunc.h>
|
||||
|
||||
/*
|
||||
@ -33,13 +35,13 @@ static char *Sysfunc_system_date(void)
|
||||
|
||||
time(&cur_time_secs);
|
||||
cur_time_expanded = localtime(&cur_time_secs);
|
||||
#if defined(EUROPEAN_DATES)
|
||||
sprintf(buf, "%2.2d-%2.2d-%4.4d", cur_time_expanded->tm_mday,
|
||||
if (EuroDates == 1)
|
||||
sprintf(buf, "%2.2d-%2.2d-%4.4d", cur_time_expanded->tm_mday,
|
||||
cur_time_expanded->tm_mon+1, cur_time_expanded->tm_year+1900);
|
||||
#else
|
||||
sprintf(buf, "%2.2d-%2.2d-%4.4d", cur_time_expanded->tm_mon+1,
|
||||
else
|
||||
sprintf(buf, "%2.2d-%2.2d-%4.4d", cur_time_expanded->tm_mon+1,
|
||||
cur_time_expanded->tm_mday, cur_time_expanded->tm_year+1900);
|
||||
#endif
|
||||
|
||||
return &buf[0];
|
||||
}
|
||||
|
||||
|
@ -10,7 +10,7 @@
|
||||
*
|
||||
*
|
||||
* IDENTIFICATION
|
||||
* $Header: /cvsroot/pgsql/src/backend/postmaster/postmaster.c,v 1.34 1997/01/24 18:27:29 scrappy Exp $
|
||||
* $Header: /cvsroot/pgsql/src/backend/postmaster/postmaster.c,v 1.35 1997/01/26 15:30:23 scrappy Exp $
|
||||
*
|
||||
* NOTES
|
||||
*
|
||||
@ -251,7 +251,7 @@ PostmasterMain(int argc, char *argv[])
|
||||
DataDir = getenv("PGDATA"); /* default value */
|
||||
|
||||
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:demM:no:p:Ss")) != EOF) {
|
||||
switch (opt) {
|
||||
case 'a':
|
||||
/* Set the authentication system. */
|
||||
@ -294,13 +294,19 @@ PostmasterMain(int argc, char *argv[])
|
||||
else
|
||||
DebugLvl = 1;
|
||||
break;
|
||||
case 'm':
|
||||
case 'e':
|
||||
/*
|
||||
* Use european date formats.
|
||||
*/
|
||||
EuroDates = 1;
|
||||
break;
|
||||
case 'm':
|
||||
MultiplexedBackends = 1;
|
||||
MultiplexedBackendPort = atoi(optarg);
|
||||
break;
|
||||
case 'M':
|
||||
/* ignore this flag. This may be passed in because the
|
||||
program was run as 'postgres -M' instead of 'postmaster' */
|
||||
program was run as 'postgres -M' instead of 'postmaster' */
|
||||
break;
|
||||
case 'n':
|
||||
/* Don't reinit shared mem after abnormal exit */
|
||||
@ -1128,6 +1134,10 @@ DoExec(StartupInfo *packet, int portFd)
|
||||
#endif /* WIN32 */
|
||||
|
||||
}
|
||||
|
||||
/* tell the backend we're using European dates */
|
||||
if (EuroDates == 1)
|
||||
av[ac++] = "-e";
|
||||
|
||||
/* tell the multiplexed backend to start on a certain port */
|
||||
if (MultiplexedBackends) {
|
||||
|
@ -7,7 +7,7 @@
|
||||
*
|
||||
*
|
||||
* IDENTIFICATION
|
||||
* $Header: /cvsroot/pgsql/src/backend/tcop/postgres.c,v 1.25 1997/01/14 08:05:26 bryanh Exp $
|
||||
* $Header: /cvsroot/pgsql/src/backend/tcop/postgres.c,v 1.26 1997/01/26 15:30:48 scrappy Exp $
|
||||
*
|
||||
* NOTES
|
||||
* this is the "main" module of the postgres backend and
|
||||
@ -784,6 +784,7 @@ PostgresMain(int argc, char *argv[])
|
||||
int flagQ;
|
||||
int flagS;
|
||||
int flagE;
|
||||
int flagEu;
|
||||
int flag;
|
||||
|
||||
char *DBName = NULL;
|
||||
@ -842,7 +843,7 @@ PostgresMain(int argc, char *argv[])
|
||||
* parse command line arguments
|
||||
* ----------------
|
||||
*/
|
||||
flagC = flagQ = flagS = flagE = ShowStats = 0;
|
||||
flagC = flagQ = flagS = flagE = flagEu = ShowStats = 0;
|
||||
ShowParserStats = ShowPlannerStats = ShowExecutorStats = 0;
|
||||
|
||||
/* get hostname is either the environment variable PGHOST
|
||||
@ -856,7 +857,7 @@ PostgresMain(int argc, char *argv[])
|
||||
DataDir = getenv("PGDATA"); /* default */
|
||||
multiplexedBackend = false; /* default */
|
||||
|
||||
while ((flag = getopt(argc, argv, "B:bCD:d:Ef:iLm:MNo:P:pQSst:x:F"))
|
||||
while ((flag = getopt(argc, argv, "B:bCD:d:Eef:iLm:MNo:P:pQSst:x:F"))
|
||||
!= EOF)
|
||||
switch (flag) {
|
||||
|
||||
@ -907,6 +908,14 @@ PostgresMain(int argc, char *argv[])
|
||||
flagE = 1;
|
||||
break;
|
||||
|
||||
case 'e':
|
||||
/* --------------------------
|
||||
* Use european date formats.
|
||||
* --------------------------
|
||||
*/
|
||||
flagEu = 1;
|
||||
break;
|
||||
|
||||
case 'F':
|
||||
/* --------------------
|
||||
* turn off fsync
|
||||
@ -1135,6 +1144,7 @@ PostgresMain(int argc, char *argv[])
|
||||
Noversion = flagC;
|
||||
Quiet = flagQ;
|
||||
EchoQuery = flagE;
|
||||
EuroDates = flagEu;
|
||||
|
||||
/* ----------------
|
||||
* print flags
|
||||
@ -1146,6 +1156,7 @@ PostgresMain(int argc, char *argv[])
|
||||
printf("\tNoversion = %c\n", Noversion ? 't' : 'f');
|
||||
printf("\tstable = %c\n", flagS ? 't' : 'f');
|
||||
printf("\ttimings = %c\n", ShowStats ? 't' : 'f');
|
||||
printf("\tdates = %s\n", EuroDates ? "European" : "Normal");
|
||||
printf("\tbufsize = %d\n", NBuffers);
|
||||
|
||||
printf("\tquery echo = %c\n", EchoQuery ? 't' : 'f');
|
||||
@ -1271,7 +1282,7 @@ PostgresMain(int argc, char *argv[])
|
||||
*/
|
||||
if (IsUnderPostmaster == false) {
|
||||
puts("\nPOSTGRES backend interactive interface");
|
||||
puts("$Revision: 1.25 $ $Date: 1997/01/14 08:05:26 $");
|
||||
puts("$Revision: 1.26 $ $Date: 1997/01/26 15:30:48 $");
|
||||
}
|
||||
|
||||
/* ----------------
|
||||
|
@ -7,7 +7,7 @@
|
||||
*
|
||||
*
|
||||
* IDENTIFICATION
|
||||
* $Header: /cvsroot/pgsql/src/backend/utils/adt/Attic/datetimes.c,v 1.7 1996/11/14 21:38:58 scrappy Exp $
|
||||
* $Header: /cvsroot/pgsql/src/backend/utils/adt/Attic/datetimes.c,v 1.8 1997/01/26 15:31:12 scrappy Exp $
|
||||
*
|
||||
*-------------------------------------------------------------------------
|
||||
*/
|
||||
@ -15,6 +15,7 @@
|
||||
#include <string.h>
|
||||
|
||||
#include <postgres.h>
|
||||
#include <miscadmin.h>
|
||||
#include <utils/builtins.h>
|
||||
#include <utils/datetime.h>
|
||||
|
||||
@ -50,19 +51,19 @@ date_in(char *datestr)
|
||||
# define CHECK_DATE_LEN(datestr) 1
|
||||
#endif
|
||||
|
||||
#ifndef EUROPEAN_DATES
|
||||
if (!CHECK_DATE_LEN(datestr) ||
|
||||
sscanf(datestr, "%d%*c%d%*c%d", &m, &d, &y) != 3) {
|
||||
elog(WARN, "date_in: date \"%s\" not of the form mm-dd-yyyy",
|
||||
datestr);
|
||||
if (EuroDates == 1) { /* Expect european format dates */
|
||||
if (!CHECK_DATE_LEN(datestr) ||
|
||||
sscanf(datestr, "%d%*c%d%*c%d", &d, &m, &y) != 3) {
|
||||
elog(WARN, "date_in: date \"%s\" not of the form dd-mm-yyyy",
|
||||
datestr);
|
||||
}
|
||||
} else {
|
||||
if (!CHECK_DATE_LEN(datestr) ||
|
||||
sscanf(datestr, "%d%*c%d%*c%d", &m, &d, &y) != 3) {
|
||||
elog(WARN, "date_in: date \"%s\" not of the form mm-dd-yyyy",
|
||||
datestr);
|
||||
}
|
||||
}
|
||||
#else
|
||||
if (!CHECK_DATE_LEN(datestr) ||
|
||||
sscanf(datestr, "%d%*c%d%*c%d", &d, &m, &y) != 3) {
|
||||
elog(WARN, "date_in: date \"%s\" not of the form dd-mm-yyyy",
|
||||
datestr);
|
||||
}
|
||||
#endif
|
||||
if (y < 0 || y > 32767)
|
||||
elog(WARN, "date_in: year must be limited to values 0 through 32767 in \"%s\"", datestr);
|
||||
if (m < 1 || m > 12)
|
||||
@ -94,13 +95,12 @@ date_out(int4 dateVal)
|
||||
date = (DateADT*)&dateStore;
|
||||
dateStore = dateVal;
|
||||
|
||||
#ifndef EUROPEAN_DATES
|
||||
sprintf(datestr, "%02d-%02d-%04d",
|
||||
(int)date->month, (int)date->day, (int)date->year);
|
||||
#else
|
||||
sprintf(datestr, "%02d-%02d-%04d",
|
||||
(int)date->day, (int)date->month, (int)date->year);
|
||||
#endif
|
||||
if (EuroDates == 1) /* Output european format dates */
|
||||
sprintf(datestr, "%02d-%02d-%04d",
|
||||
(int)date->day, (int)date->month, (int)date->year);
|
||||
else
|
||||
sprintf(datestr, "%02d-%02d-%04d",
|
||||
(int)date->month, (int)date->day, (int)date->year);
|
||||
|
||||
return datestr;
|
||||
}
|
||||
|
@ -7,7 +7,7 @@
|
||||
*
|
||||
*
|
||||
* IDENTIFICATION
|
||||
* $Header: /cvsroot/pgsql/src/backend/utils/init/globals.c,v 1.4 1997/01/14 08:05:36 bryanh Exp $
|
||||
* $Header: /cvsroot/pgsql/src/backend/utils/init/globals.c,v 1.5 1997/01/26 15:31:29 scrappy Exp $
|
||||
*
|
||||
* NOTES
|
||||
* Globals used all over the place should be declared here and not
|
||||
@ -65,6 +65,8 @@ bool IsPostmaster = false;
|
||||
|
||||
short DebugLvl = 0;
|
||||
|
||||
int EuroDates = 0;
|
||||
|
||||
char *IndexedCatalogNames[] = {
|
||||
AttributeRelationName,
|
||||
ProcedureRelationName,
|
||||
|
@ -21,7 +21,7 @@
|
||||
|
||||
/* Define one for either <history.h> or <readline/history.h>
|
||||
*/
|
||||
/* #undef HAVE_HISTORY */
|
||||
/* #undef HAVE_HISTORY */
|
||||
|
||||
|
||||
#define HAVE_SYS_SELECT_H
|
||||
@ -265,11 +265,6 @@ typedef unsigned char slock_t;
|
||||
|
||||
#define DEF_PGPORT "5432"
|
||||
|
||||
/* turn this on if you prefer European style dates instead of American
|
||||
* style dates
|
||||
*/
|
||||
/* #define EUROPEAN_DATES */
|
||||
|
||||
/*
|
||||
* If you do not plan to use Host based authentication,
|
||||
* comment out the following line
|
||||
|
@ -11,7 +11,7 @@
|
||||
*
|
||||
* Copyright (c) 1994, Regents of the University of California
|
||||
*
|
||||
* $Id: miscadmin.h,v 1.4 1996/11/14 10:25:42 bryanh Exp $
|
||||
* $Id: miscadmin.h,v 1.5 1997/01/26 15:32:06 scrappy Exp $
|
||||
*
|
||||
* NOTES
|
||||
* some of the information in this file will be moved to
|
||||
@ -57,6 +57,8 @@ extern bool IsPostmaster;
|
||||
|
||||
extern short DebugLvl;
|
||||
|
||||
extern int EuroDates;
|
||||
|
||||
extern Oid LastOidProcessed; /* for query rewrite */
|
||||
|
||||
#define MAX_PARSE_BUFFER 8192
|
||||
|
@ -1,6 +1,6 @@
|
||||
.\" This is -*-nroff-*-
|
||||
.\" XXX standard disclaimer belongs here....
|
||||
.\" $Header: /cvsroot/pgsql/src/man/Attic/postgres.1,v 1.4 1996/12/11 22:58:14 momjian Exp $
|
||||
.\" $Header: /cvsroot/pgsql/src/man/Attic/postgres.1,v 1.5 1997/01/26 15:32:20 scrappy Exp $
|
||||
.TH POSTGRES95 UNIX 12/08/96 Postgres95 Postgres95
|
||||
.SH NAME
|
||||
postgres \(em the Postgres backend server
|
||||
@ -25,6 +25,9 @@ filedes]
|
||||
[\c
|
||||
.BR "-Q"
|
||||
]
|
||||
[\c
|
||||
.BR "-e"
|
||||
]
|
||||
.br
|
||||
[\c
|
||||
.BR "-d"
|
||||
@ -78,9 +81,6 @@ has allocated for the backend server processes that it starts. If the
|
||||
backend is running standalone, this specifies the number of buffers to
|
||||
allocate. This value defaults to 64.
|
||||
.TP
|
||||
.BR "-E"
|
||||
Echo all queries.
|
||||
.TP
|
||||
.BR "-F"
|
||||
Disable automatic fsync() call after each transaction.
|
||||
This option improves performance, but an operating system crash
|
||||
@ -96,6 +96,26 @@ useful for interactive use.
|
||||
.BR "-Q"
|
||||
Specifies \*(lqquiet\*(rq mode.
|
||||
.TP
|
||||
.BR "-E"
|
||||
Echo all queries.
|
||||
.TP
|
||||
.BR "-e"
|
||||
The
|
||||
.IR "-e"
|
||||
option controls how dates are input to and output from the database.
|
||||
.IP
|
||||
If the
|
||||
.IR "-e"
|
||||
option is supplied, then all dates passed to and from the frontend
|
||||
processes will be assumed to be in
|
||||
.IR "European"
|
||||
format ie.
|
||||
.IR "DD-MM-YYYY"
|
||||
otherwise dates are input and output in
|
||||
.IR "American"
|
||||
format ie.
|
||||
.IR "MM-DD-YYYY"
|
||||
.TP
|
||||
.BR "-d" " debug_level"
|
||||
Turns on debugging at the numeric level
|
||||
.IR "debug_level" .
|
||||
|
@ -1,6 +1,6 @@
|
||||
.\" This is -*-nroff-*-
|
||||
.\" XXX standard disclaimer belongs here....
|
||||
.\" $Header: /cvsroot/pgsql/src/man/Attic/postmaster.1,v 1.2 1996/12/11 00:28:02 momjian Exp $
|
||||
.\" $Header: /cvsroot/pgsql/src/man/Attic/postmaster.1,v 1.3 1997/01/26 15:32:28 scrappy Exp $
|
||||
.TH POSTMASTER UNIX 11/05/95 PostgreSQL PostgreSQL
|
||||
.SH "NAME"
|
||||
postmaster \(em run the Postgres postmaster
|
||||
@ -29,6 +29,9 @@ backend_pathname]
|
||||
[\c
|
||||
.BR "-n" \c
|
||||
]
|
||||
[\c
|
||||
.BR "-e" \c
|
||||
]
|
||||
.br
|
||||
[\c
|
||||
.BR "-o"
|
||||
@ -170,6 +173,23 @@ programmer can then use the
|
||||
.IR shmemdoc
|
||||
program to examine shared memory and semaphore state.
|
||||
.TP
|
||||
.BR "-e"
|
||||
The
|
||||
.IR "-e"
|
||||
option controls how dates are input to and output from the database.
|
||||
.IP
|
||||
If the
|
||||
.IR "-e"
|
||||
option is supplied, then all dates passed to and from the frontend
|
||||
processes will be assumed to be in
|
||||
.IR "European"
|
||||
format ie.
|
||||
.IR "DD-MM-YYYY"
|
||||
otherwise dates are input and output in
|
||||
.IR "American"
|
||||
format ie.
|
||||
.IR "MM-DD-YYYY"
|
||||
.TP
|
||||
.BR "-o" " backend_options"
|
||||
The
|
||||
.IR postgres (1)
|
||||
|
Loading…
x
Reference in New Issue
Block a user