Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit8de20a3

Browse files
author
Thomas G. Lockhart
committed
Use environment variable PGDATESTYLE on backend startup to initialize
date/time formats and conventions.
1 parenta58825a commit8de20a3

File tree

1 file changed

+33
-4
lines changed

1 file changed

+33
-4
lines changed

‎src/backend/tcop/postgres.c

Lines changed: 33 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
*
88
*
99
* IDENTIFICATION
10-
* $Header: /cvsroot/pgsql/src/backend/tcop/postgres.c,v 1.56 1997/12/11 17:36:42 momjian Exp $
10+
* $Header: /cvsroot/pgsql/src/backend/tcop/postgres.c,v 1.57 1997/12/16 15:57:00 thomas Exp $
1111
*
1212
* NOTES
1313
* this is the "main" module of the postgres backend and
@@ -854,6 +854,7 @@ PostgresMain(int argc, char *argv[])
854854
Dlelem*curr;
855855
intstatus;
856856

857+
char*DBDate=NULL;
857858
externintoptind;
858859
externchar*optarg;
859860
externshortDebugLvl;
@@ -882,6 +883,10 @@ PostgresMain(int argc, char *argv[])
882883
*parse command line arguments
883884
* ----------------
884885
*/
886+
887+
/*
888+
* Set default values.
889+
*/
885890
flagC=flagQ=flagE=flagEu=ShowStats=0;
886891
ShowParserStats=ShowPlannerStats=ShowExecutorStats=0;
887892
#ifdefLOCK_MGR_DEBUG
@@ -893,9 +898,33 @@ PostgresMain(int argc, char *argv[])
893898
* NULL means Unix-socket only
894899
*/
895900
hostName=getenv("PGHOST");
901+
DataDir=getenv("PGDATA");
902+
/*
903+
* Try to get initial values for date styles and formats.
904+
* Does not do a complete job, but should be good enough for backend.
905+
* Cannot call parse_date() since palloc/pfree memory is not set up yet.
906+
*/
907+
DBDate=getenv("PGDATESTYLE");
908+
if (DBDate!=NULL)
909+
{
910+
if (strcasecmp(DBDate,"ISO")==0)
911+
DateStyle=USE_ISO_DATES;
912+
elseif (strcasecmp(DBDate,"SQL")==0)
913+
DateStyle=USE_SQL_DATES;
914+
elseif (strcasecmp(DBDate,"POSTGRES")==0)
915+
DateStyle=USE_POSTGRES_DATES;
916+
elseif (strcasecmp(DBDate,"GERMAN")==0)
917+
{
918+
DateStyle=USE_GERMAN_DATES;
919+
EuroDates= TRUE;
920+
}
896921

897-
DataDir=getenv("PGDATA");/* default */
898-
multiplexedBackend= false;/* default */
922+
if (strcasecmp(DBDate,"NONEURO")==0)
923+
EuroDates= FALSE;
924+
elseif (strcasecmp(DBDate,"EURO")==0)
925+
EuroDates= TRUE;
926+
}
927+
multiplexedBackend= false;
899928

900929
while ((flag=getopt(argc,argv,"B:bCD:d:Eef:iK:Lm:MNo:P:pQS:st:x:F"))
901930
!=EOF)
@@ -1343,7 +1372,7 @@ PostgresMain(int argc, char *argv[])
13431372
if (IsUnderPostmaster== false)
13441373
{
13451374
puts("\nPOSTGRES backend interactive interface");
1346-
puts("$Revision: 1.56 $ $Date: 1997/12/11 17:36:42 $");
1375+
puts("$Revision: 1.57 $ $Date: 1997/12/16 15:57:00 $");
13471376
}
13481377

13491378
/* ----------------

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp