Skip to content

Commit 2938eec

Browse files
committed
Extend GUC concepts of parse_hook and assign_hook to all four supported
datatypes, not only strings. parse_hook is useless for bool, I suppose, but it seems possibly useful for int and double to apply variable-specific constraints that are more complex than simple range limits. assign_hook is definitely useful for all datatypes --- we need it right now for bool to support date cache reset when changing Australian timezone rule setting. Also, clean up some residual problems with the reset all/show all patch, including memory leaks and mistaken reset of PostPortNumber. It seems best that RESET ALL not touch variables that don't have SUSET or USERSET context.
1 parent 89765fa commit 2938eec

File tree

6 files changed

+223
-136
lines changed

6 files changed

+223
-136
lines changed

src/backend/bootstrap/bootstrap.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
* Portions Copyright (c) 1994, Regents of the University of California
99
*
1010
* IDENTIFICATION
11-
* $Header: /cvsroot/pgsql/src/backend/bootstrap/bootstrap.c,v 1.108 2001/06/03 14:53:56 petere Exp $
11+
* $Header: /cvsroot/pgsql/src/backend/bootstrap/bootstrap.c,v 1.109 2001/06/12 22:54:05 tgl Exp $
1212
*
1313
*-------------------------------------------------------------------------
1414
*/
@@ -243,7 +243,7 @@ BootstrapMain(int argc, char *argv[])
243243
dbName = NULL;
244244
if (!IsUnderPostmaster)
245245
{
246-
ResetAllOptions();
246+
ResetAllOptions(true);
247247
potential_DataDir = getenv("PGDATA"); /* Null if no PGDATA
248248
* variable */
249249
}

src/backend/commands/variable.c

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
*
1010
*
1111
* IDENTIFICATION
12-
* $Header: /cvsroot/pgsql/src/backend/commands/variable.c,v 1.49 2001/06/07 04:50:56 momjian Exp $
12+
* $Header: /cvsroot/pgsql/src/backend/commands/variable.c,v 1.50 2001/06/12 22:54:05 tgl Exp $
1313
*
1414
*-------------------------------------------------------------------------
1515
*/
@@ -792,7 +792,9 @@ ResetPGVariable(const char *name)
792792
reset_datestyle();
793793
reset_timezone();
794794

795-
ResetAllOptions();
795+
ResetAllOptions(false);
796796
} else
797-
SetConfigOption(name, NULL, superuser() ? PGC_SUSET : PGC_USERSET, false);
797+
SetConfigOption(name, NULL,
798+
superuser() ? PGC_SUSET : PGC_USERSET,
799+
false);
798800
}

src/backend/postmaster/postmaster.c

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@
2828
*
2929
*
3030
* IDENTIFICATION
31-
* $Header: /cvsroot/pgsql/src/backend/postmaster/postmaster.c,v 1.218 2001/06/11 04:12:29 tgl Exp $
31+
* $Header: /cvsroot/pgsql/src/backend/postmaster/postmaster.c,v 1.219 2001/06/12 22:54:05 tgl Exp $
3232
*
3333
* NOTES
3434
*
@@ -362,9 +362,13 @@ PostmasterMain(int argc, char *argv[])
362362
/*
363363
* Options setup
364364
*/
365-
potential_DataDir = getenv("PGDATA"); /* default value */
365+
ResetAllOptions(true);
366+
367+
/* PGPORT environment variable, if set, overrides GUC setting */
368+
if (getenv("PGPORT"))
369+
PostPortNumber = atoi(getenv("PGPORT"));
366370

367-
ResetAllOptions();
371+
potential_DataDir = getenv("PGDATA"); /* default value */
368372

369373
/*
370374
* First we must scan for a -D argument to get the data dir. Then read

src/backend/tcop/postgres.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
*
99
*
1010
* IDENTIFICATION
11-
* $Header: /cvsroot/pgsql/src/backend/tcop/postgres.c,v 1.219 2001/06/07 04:50:57 momjian Exp $
11+
* $Header: /cvsroot/pgsql/src/backend/tcop/postgres.c,v 1.220 2001/06/12 22:54:06 tgl Exp $
1212
*
1313
* NOTES
1414
* this is the "main" module of the postgres backend and
@@ -1156,7 +1156,7 @@ PostgresMain(int argc, char *argv[], int real_argc, char *real_argv[], const cha
11561156

11571157
if (!IsUnderPostmaster)
11581158
{
1159-
ResetAllOptions();
1159+
ResetAllOptions(true);
11601160
potential_DataDir = getenv("PGDATA");
11611161
}
11621162
StatFp = stderr;
@@ -1709,7 +1709,7 @@ PostgresMain(int argc, char *argv[], int real_argc, char *real_argv[], const cha
17091709
if (!IsUnderPostmaster)
17101710
{
17111711
puts("\nPOSTGRES backend interactive interface ");
1712-
puts("$Revision: 1.219 $ $Date: 2001/06/07 04:50:57 $\n");
1712+
puts("$Revision: 1.220 $ $Date: 2001/06/12 22:54:06 $\n");
17131713
}
17141714

17151715
/*

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy