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 <time.h>
|
||||||
|
|
||||||
#include <config.h>
|
#include <config.h>
|
||||||
|
#include <postgres.h>
|
||||||
|
#include <miscadmin.h>
|
||||||
#include <parser/sysfunc.h>
|
#include <parser/sysfunc.h>
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@ -33,13 +35,13 @@ static char *Sysfunc_system_date(void)
|
|||||||
|
|
||||||
time(&cur_time_secs);
|
time(&cur_time_secs);
|
||||||
cur_time_expanded = localtime(&cur_time_secs);
|
cur_time_expanded = localtime(&cur_time_secs);
|
||||||
#if defined(EUROPEAN_DATES)
|
if (EuroDates == 1)
|
||||||
sprintf(buf, "%2.2d-%2.2d-%4.4d", cur_time_expanded->tm_mday,
|
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);
|
cur_time_expanded->tm_mon+1, cur_time_expanded->tm_year+1900);
|
||||||
#else
|
else
|
||||||
sprintf(buf, "%2.2d-%2.2d-%4.4d", cur_time_expanded->tm_mon+1,
|
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);
|
cur_time_expanded->tm_mday, cur_time_expanded->tm_year+1900);
|
||||||
#endif
|
|
||||||
return &buf[0];
|
return &buf[0];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -10,7 +10,7 @@
|
|||||||
*
|
*
|
||||||
*
|
*
|
||||||
* IDENTIFICATION
|
* 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
|
* NOTES
|
||||||
*
|
*
|
||||||
@ -251,7 +251,7 @@ PostmasterMain(int argc, char *argv[])
|
|||||||
DataDir = getenv("PGDATA"); /* default value */
|
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:demM:no:p:Ss")) != EOF) {
|
||||||
switch (opt) {
|
switch (opt) {
|
||||||
case 'a':
|
case 'a':
|
||||||
/* Set the authentication system. */
|
/* Set the authentication system. */
|
||||||
@ -294,13 +294,19 @@ PostmasterMain(int argc, char *argv[])
|
|||||||
else
|
else
|
||||||
DebugLvl = 1;
|
DebugLvl = 1;
|
||||||
break;
|
break;
|
||||||
case 'm':
|
case 'e':
|
||||||
|
/*
|
||||||
|
* Use european date formats.
|
||||||
|
*/
|
||||||
|
EuroDates = 1;
|
||||||
|
break;
|
||||||
|
case 'm':
|
||||||
MultiplexedBackends = 1;
|
MultiplexedBackends = 1;
|
||||||
MultiplexedBackendPort = atoi(optarg);
|
MultiplexedBackendPort = atoi(optarg);
|
||||||
break;
|
break;
|
||||||
case 'M':
|
case 'M':
|
||||||
/* ignore this flag. This may be passed in because the
|
/* 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;
|
break;
|
||||||
case 'n':
|
case 'n':
|
||||||
/* Don't reinit shared mem after abnormal exit */
|
/* Don't reinit shared mem after abnormal exit */
|
||||||
@ -1128,6 +1134,10 @@ DoExec(StartupInfo *packet, int portFd)
|
|||||||
#endif /* WIN32 */
|
#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 */
|
/* tell the multiplexed backend to start on a certain port */
|
||||||
if (MultiplexedBackends) {
|
if (MultiplexedBackends) {
|
||||||
|
@ -7,7 +7,7 @@
|
|||||||
*
|
*
|
||||||
*
|
*
|
||||||
* IDENTIFICATION
|
* 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
|
* NOTES
|
||||||
* this is the "main" module of the postgres backend and
|
* this is the "main" module of the postgres backend and
|
||||||
@ -784,6 +784,7 @@ PostgresMain(int argc, char *argv[])
|
|||||||
int flagQ;
|
int flagQ;
|
||||||
int flagS;
|
int flagS;
|
||||||
int flagE;
|
int flagE;
|
||||||
|
int flagEu;
|
||||||
int flag;
|
int flag;
|
||||||
|
|
||||||
char *DBName = NULL;
|
char *DBName = NULL;
|
||||||
@ -842,7 +843,7 @@ PostgresMain(int argc, char *argv[])
|
|||||||
* parse command line arguments
|
* parse command line arguments
|
||||||
* ----------------
|
* ----------------
|
||||||
*/
|
*/
|
||||||
flagC = flagQ = flagS = flagE = ShowStats = 0;
|
flagC = flagQ = flagS = flagE = flagEu = ShowStats = 0;
|
||||||
ShowParserStats = ShowPlannerStats = ShowExecutorStats = 0;
|
ShowParserStats = ShowPlannerStats = ShowExecutorStats = 0;
|
||||||
|
|
||||||
/* get hostname is either the environment variable PGHOST
|
/* get hostname is either the environment variable PGHOST
|
||||||
@ -856,7 +857,7 @@ PostgresMain(int argc, char *argv[])
|
|||||||
DataDir = getenv("PGDATA"); /* default */
|
DataDir = getenv("PGDATA"); /* default */
|
||||||
multiplexedBackend = false; /* 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)
|
!= EOF)
|
||||||
switch (flag) {
|
switch (flag) {
|
||||||
|
|
||||||
@ -907,6 +908,14 @@ PostgresMain(int argc, char *argv[])
|
|||||||
flagE = 1;
|
flagE = 1;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
case 'e':
|
||||||
|
/* --------------------------
|
||||||
|
* Use european date formats.
|
||||||
|
* --------------------------
|
||||||
|
*/
|
||||||
|
flagEu = 1;
|
||||||
|
break;
|
||||||
|
|
||||||
case 'F':
|
case 'F':
|
||||||
/* --------------------
|
/* --------------------
|
||||||
* turn off fsync
|
* turn off fsync
|
||||||
@ -1135,6 +1144,7 @@ PostgresMain(int argc, char *argv[])
|
|||||||
Noversion = flagC;
|
Noversion = flagC;
|
||||||
Quiet = flagQ;
|
Quiet = flagQ;
|
||||||
EchoQuery = flagE;
|
EchoQuery = flagE;
|
||||||
|
EuroDates = flagEu;
|
||||||
|
|
||||||
/* ----------------
|
/* ----------------
|
||||||
* print flags
|
* print flags
|
||||||
@ -1146,6 +1156,7 @@ PostgresMain(int argc, char *argv[])
|
|||||||
printf("\tNoversion = %c\n", Noversion ? 't' : 'f');
|
printf("\tNoversion = %c\n", Noversion ? 't' : 'f');
|
||||||
printf("\tstable = %c\n", flagS ? 't' : 'f');
|
printf("\tstable = %c\n", flagS ? 't' : 'f');
|
||||||
printf("\ttimings = %c\n", ShowStats ? 't' : 'f');
|
printf("\ttimings = %c\n", ShowStats ? 't' : 'f');
|
||||||
|
printf("\tdates = %s\n", EuroDates ? "European" : "Normal");
|
||||||
printf("\tbufsize = %d\n", NBuffers);
|
printf("\tbufsize = %d\n", NBuffers);
|
||||||
|
|
||||||
printf("\tquery echo = %c\n", EchoQuery ? 't' : 'f');
|
printf("\tquery echo = %c\n", EchoQuery ? 't' : 'f');
|
||||||
@ -1271,7 +1282,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.25 $ $Date: 1997/01/14 08:05:26 $");
|
puts("$Revision: 1.26 $ $Date: 1997/01/26 15:30:48 $");
|
||||||
}
|
}
|
||||||
|
|
||||||
/* ----------------
|
/* ----------------
|
||||||
|
@ -7,7 +7,7 @@
|
|||||||
*
|
*
|
||||||
*
|
*
|
||||||
* IDENTIFICATION
|
* 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 <string.h>
|
||||||
|
|
||||||
#include <postgres.h>
|
#include <postgres.h>
|
||||||
|
#include <miscadmin.h>
|
||||||
#include <utils/builtins.h>
|
#include <utils/builtins.h>
|
||||||
#include <utils/datetime.h>
|
#include <utils/datetime.h>
|
||||||
|
|
||||||
@ -50,19 +51,19 @@ date_in(char *datestr)
|
|||||||
# define CHECK_DATE_LEN(datestr) 1
|
# define CHECK_DATE_LEN(datestr) 1
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifndef EUROPEAN_DATES
|
if (EuroDates == 1) { /* Expect european format dates */
|
||||||
if (!CHECK_DATE_LEN(datestr) ||
|
if (!CHECK_DATE_LEN(datestr) ||
|
||||||
sscanf(datestr, "%d%*c%d%*c%d", &m, &d, &y) != 3) {
|
sscanf(datestr, "%d%*c%d%*c%d", &d, &m, &y) != 3) {
|
||||||
elog(WARN, "date_in: date \"%s\" not of the form mm-dd-yyyy",
|
elog(WARN, "date_in: date \"%s\" not of the form dd-mm-yyyy",
|
||||||
datestr);
|
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)
|
if (y < 0 || y > 32767)
|
||||||
elog(WARN, "date_in: year must be limited to values 0 through 32767 in \"%s\"", datestr);
|
elog(WARN, "date_in: year must be limited to values 0 through 32767 in \"%s\"", datestr);
|
||||||
if (m < 1 || m > 12)
|
if (m < 1 || m > 12)
|
||||||
@ -94,13 +95,12 @@ date_out(int4 dateVal)
|
|||||||
date = (DateADT*)&dateStore;
|
date = (DateADT*)&dateStore;
|
||||||
dateStore = dateVal;
|
dateStore = dateVal;
|
||||||
|
|
||||||
#ifndef EUROPEAN_DATES
|
if (EuroDates == 1) /* Output european format dates */
|
||||||
sprintf(datestr, "%02d-%02d-%04d",
|
sprintf(datestr, "%02d-%02d-%04d",
|
||||||
(int)date->month, (int)date->day, (int)date->year);
|
(int)date->day, (int)date->month, (int)date->year);
|
||||||
#else
|
else
|
||||||
sprintf(datestr, "%02d-%02d-%04d",
|
sprintf(datestr, "%02d-%02d-%04d",
|
||||||
(int)date->day, (int)date->month, (int)date->year);
|
(int)date->month, (int)date->day, (int)date->year);
|
||||||
#endif
|
|
||||||
|
|
||||||
return datestr;
|
return datestr;
|
||||||
}
|
}
|
||||||
|
@ -7,7 +7,7 @@
|
|||||||
*
|
*
|
||||||
*
|
*
|
||||||
* IDENTIFICATION
|
* 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
|
* 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
|
||||||
@ -65,6 +65,8 @@ bool IsPostmaster = false;
|
|||||||
|
|
||||||
short DebugLvl = 0;
|
short DebugLvl = 0;
|
||||||
|
|
||||||
|
int EuroDates = 0;
|
||||||
|
|
||||||
char *IndexedCatalogNames[] = {
|
char *IndexedCatalogNames[] = {
|
||||||
AttributeRelationName,
|
AttributeRelationName,
|
||||||
ProcedureRelationName,
|
ProcedureRelationName,
|
||||||
|
@ -21,7 +21,7 @@
|
|||||||
|
|
||||||
/* Define one for either <history.h> or <readline/history.h>
|
/* Define one for either <history.h> or <readline/history.h>
|
||||||
*/
|
*/
|
||||||
/* #undef HAVE_HISTORY */
|
/* #undef HAVE_HISTORY */
|
||||||
|
|
||||||
|
|
||||||
#define HAVE_SYS_SELECT_H
|
#define HAVE_SYS_SELECT_H
|
||||||
@ -265,11 +265,6 @@ typedef unsigned char slock_t;
|
|||||||
|
|
||||||
#define DEF_PGPORT "5432"
|
#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,
|
* If you do not plan to use Host based authentication,
|
||||||
* comment out the following line
|
* comment out the following line
|
||||||
|
@ -11,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.4 1996/11/14 10:25:42 bryanh Exp $
|
* $Id: miscadmin.h,v 1.5 1997/01/26 15:32:06 scrappy 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
|
||||||
@ -57,6 +57,8 @@ extern bool IsPostmaster;
|
|||||||
|
|
||||||
extern short DebugLvl;
|
extern short DebugLvl;
|
||||||
|
|
||||||
|
extern int EuroDates;
|
||||||
|
|
||||||
extern Oid LastOidProcessed; /* for query rewrite */
|
extern Oid LastOidProcessed; /* for query rewrite */
|
||||||
|
|
||||||
#define MAX_PARSE_BUFFER 8192
|
#define MAX_PARSE_BUFFER 8192
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
.\" This is -*-nroff-*-
|
.\" This is -*-nroff-*-
|
||||||
.\" XXX standard disclaimer belongs here....
|
.\" 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
|
.TH POSTGRES95 UNIX 12/08/96 Postgres95 Postgres95
|
||||||
.SH NAME
|
.SH NAME
|
||||||
postgres \(em the Postgres backend server
|
postgres \(em the Postgres backend server
|
||||||
@ -25,6 +25,9 @@ filedes]
|
|||||||
[\c
|
[\c
|
||||||
.BR "-Q"
|
.BR "-Q"
|
||||||
]
|
]
|
||||||
|
[\c
|
||||||
|
.BR "-e"
|
||||||
|
]
|
||||||
.br
|
.br
|
||||||
[\c
|
[\c
|
||||||
.BR "-d"
|
.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
|
backend is running standalone, this specifies the number of buffers to
|
||||||
allocate. This value defaults to 64.
|
allocate. This value defaults to 64.
|
||||||
.TP
|
.TP
|
||||||
.BR "-E"
|
|
||||||
Echo all queries.
|
|
||||||
.TP
|
|
||||||
.BR "-F"
|
.BR "-F"
|
||||||
Disable automatic fsync() call after each transaction.
|
Disable automatic fsync() call after each transaction.
|
||||||
This option improves performance, but an operating system crash
|
This option improves performance, but an operating system crash
|
||||||
@ -96,6 +96,26 @@ useful for interactive use.
|
|||||||
.BR "-Q"
|
.BR "-Q"
|
||||||
Specifies \*(lqquiet\*(rq mode.
|
Specifies \*(lqquiet\*(rq mode.
|
||||||
.TP
|
.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"
|
.BR "-d" " debug_level"
|
||||||
Turns on debugging at the numeric level
|
Turns on debugging at the numeric level
|
||||||
.IR "debug_level" .
|
.IR "debug_level" .
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
.\" This is -*-nroff-*-
|
.\" This is -*-nroff-*-
|
||||||
.\" XXX standard disclaimer belongs here....
|
.\" 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
|
.TH POSTMASTER UNIX 11/05/95 PostgreSQL PostgreSQL
|
||||||
.SH "NAME"
|
.SH "NAME"
|
||||||
postmaster \(em run the Postgres postmaster
|
postmaster \(em run the Postgres postmaster
|
||||||
@ -29,6 +29,9 @@ backend_pathname]
|
|||||||
[\c
|
[\c
|
||||||
.BR "-n" \c
|
.BR "-n" \c
|
||||||
]
|
]
|
||||||
|
[\c
|
||||||
|
.BR "-e" \c
|
||||||
|
]
|
||||||
.br
|
.br
|
||||||
[\c
|
[\c
|
||||||
.BR "-o"
|
.BR "-o"
|
||||||
@ -170,6 +173,23 @@ programmer can then use the
|
|||||||
.IR shmemdoc
|
.IR shmemdoc
|
||||||
program to examine shared memory and semaphore state.
|
program to examine shared memory and semaphore state.
|
||||||
.TP
|
.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"
|
.BR "-o" " backend_options"
|
||||||
The
|
The
|
||||||
.IR postgres (1)
|
.IR postgres (1)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user