Skip to content

Commit 3c104bc

Browse files
committed
Pass postmaster -d down to the postgres backend to trigger special -d
handling in the backend.
1 parent 15b95cf commit 3c104bc

File tree

2 files changed

+17
-5
lines changed

2 files changed

+17
-5
lines changed

src/backend/postmaster/postmaster.c

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@
3737
*
3838
*
3939
* IDENTIFICATION
40-
* $Header: /cvsroot/pgsql/src/backend/postmaster/postmaster.c,v 1.288 2002/09/04 20:31:24 momjian Exp $
40+
* $Header: /cvsroot/pgsql/src/backend/postmaster/postmaster.c,v 1.289 2002/09/26 05:17:00 momjian Exp $
4141
*
4242
* NOTES
4343
*
@@ -230,6 +230,8 @@ bool ClientAuthInProgress = false; /* T during new-client
230230

231231
static unsigned int random_seed = 0;
232232

233+
static int debug_flag = 0;
234+
233235
extern char *optarg;
234236
extern int optind,
235237
opterr;
@@ -452,6 +454,7 @@ PostmasterMain(int argc, char *argv[])
452454
SetConfigOption("server_min_messages", debugstr,
453455
PGC_POSTMASTER, PGC_S_ARGV);
454456
pfree(debugstr);
457+
debug_flag = atoi(optarg);
455458
break;
456459
}
457460
case 'F':
@@ -2028,6 +2031,7 @@ DoBackend(Port *port)
20282031
char *remote_host;
20292032
char *av[ARGV_SIZE * 2];
20302033
int ac = 0;
2034+
char debugbuf[ARGV_SIZE];
20312035
char protobuf[ARGV_SIZE];
20322036
char dbbuf[ARGV_SIZE];
20332037
char optbuf[ARGV_SIZE];
@@ -2208,6 +2212,15 @@ DoBackend(Port *port)
22082212

22092213
av[ac++] = "postgres";
22102214

2215+
/*
2216+
* Pass the requested debugging level along to the backend.
2217+
*/
2218+
if (debug_flag > 0)
2219+
{
2220+
sprintf(debugbuf, "-d%d", debug_flag);
2221+
av[ac++] = debugbuf;
2222+
}
2223+
22112224
/*
22122225
* Pass any backend switches specified with -o in the postmaster's own
22132226
* command line. We assume these are secure. (It's OK to mangle

src/backend/tcop/postgres.c

Lines changed: 3 additions & 4 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.294 2002/09/25 20:31:40 tgl Exp $
11+
* $Header: /cvsroot/pgsql/src/backend/tcop/postgres.c,v 1.295 2002/09/26 05:17:00 momjian Exp $
1212
*
1313
* NOTES
1414
* this is the "main" module of the postgres backend and
@@ -1281,8 +1281,7 @@ PostgresMain(int argc, char *argv[], const char *username)
12811281
* -d 0 allows user to prevent postmaster debug
12821282
* from propagating to backend.
12831283
*/
1284-
SetConfigOption("server_min_messages", "notice",
1285-
ctx, gucsource);
1284+
ResetPGVariable("server_min_messages");
12861285
}
12871286
break;
12881287

@@ -1698,7 +1697,7 @@ PostgresMain(int argc, char *argv[], const char *username)
16981697
if (!IsUnderPostmaster)
16991698
{
17001699
puts("\nPOSTGRES backend interactive interface ");
1701-
puts("$Revision: 1.294 $ $Date: 2002/09/25 20:31:40 $\n");
1700+
puts("$Revision: 1.295 $ $Date: 2002/09/26 05:17:00 $\n");
17021701
}
17031702

17041703
/*

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