Re: postmaster -d option (was Re: [GENERAL] Relation 0 does not exist) - Mailing list pgsql-hackers

From Bruce Momjian
Subject Re: postmaster -d option (was Re: [GENERAL] Relation 0 does not exist)
Date
Msg-id 200209260516.g8Q5GCx04205@candle.pha.pa.us
Whole thread Raw
In response to Re: postmaster -d option (was Re: [GENERAL] Relation 0 does not exist)  (Tom Lane <tgl@sss.pgh.pa.us>)
Responses Re: postmaster -d option (was Re: [GENERAL] Relation 0 does not exist)  (Tom Lane <tgl@sss.pgh.pa.us>)
List pgsql-hackers
Tom Lane wrote:
> Bruce Momjian <pgman@candle.pha.pa.us> writes:
> > ... Now, we just have the GUC value which does
> > propogate like the global one did.  Does the postmaster still pass -dX
> > down to the child like it used to?
>
> Evidently not; else Patrick wouldn't be complaining that it doesn't
> work like it used to.

OK, got it.  I knew server_min_messages would propogate to the client,
but that doesn't trigger the -d special cases in postgres.c.  I re-added
the -d flag propogation to the postmaster.  I also changed the postgres
-d0 behavior to just reset server_min_messages rather than setting it to
'notice.

--
  Bruce Momjian                        |  http://candle.pha.pa.us
  pgman@candle.pha.pa.us               |  (610) 359-1001
  +  If your life is a hard drive,     |  13 Roberts Road
  +  Christ can be your backup.        |  Newtown Square, Pennsylvania 19073
Index: src/backend/postmaster/postmaster.c
===================================================================
RCS file: /cvsroot/pgsql-server/src/backend/postmaster/postmaster.c,v
retrieving revision 1.288
diff -c -c -r1.288 postmaster.c
*** src/backend/postmaster/postmaster.c    4 Sep 2002 20:31:24 -0000    1.288
--- src/backend/postmaster/postmaster.c    26 Sep 2002 05:15:33 -0000
***************
*** 230,235 ****
--- 230,237 ----

  static unsigned int random_seed = 0;

+ static int    debug_flag = 0;
+
  extern char *optarg;
  extern int    optind,
              opterr;
***************
*** 452,457 ****
--- 454,460 ----
                      SetConfigOption("server_min_messages", debugstr,
                                      PGC_POSTMASTER, PGC_S_ARGV);
                      pfree(debugstr);
+                     debug_flag = atoi(optarg);
                      break;
                  }
              case 'F':
***************
*** 2028,2033 ****
--- 2031,2037 ----
      char       *remote_host;
      char       *av[ARGV_SIZE * 2];
      int            ac = 0;
+     char        debugbuf[ARGV_SIZE];
      char        protobuf[ARGV_SIZE];
      char        dbbuf[ARGV_SIZE];
      char        optbuf[ARGV_SIZE];
***************
*** 2207,2212 ****
--- 2211,2225 ----
       */

      av[ac++] = "postgres";
+
+     /*
+      * Pass the requested debugging level along to the backend.
+      */
+     if (debug_flag > 0)
+     {
+         sprintf(debugbuf, "-d%d", debug_flag);
+         av[ac++] = debugbuf;
+     }

      /*
       * Pass any backend switches specified with -o in the postmaster's own
Index: src/backend/tcop/postgres.c
===================================================================
RCS file: /cvsroot/pgsql-server/src/backend/tcop/postgres.c,v
retrieving revision 1.294
diff -c -c -r1.294 postgres.c
*** src/backend/tcop/postgres.c    25 Sep 2002 20:31:40 -0000    1.294
--- src/backend/tcop/postgres.c    26 Sep 2002 05:15:41 -0000
***************
*** 1281,1288 ****
                           * -d 0 allows user to prevent postmaster debug
                           * from propagating to backend.
                           */
!                         SetConfigOption("server_min_messages", "notice",
!                                         ctx, gucsource);
                  }
                  break;

--- 1281,1287 ----
                           * -d 0 allows user to prevent postmaster debug
                           * from propagating to backend.
                           */
!                         ResetPGVariable("server_min_messages");
                  }
                  break;


pgsql-hackers by date:

Previous
From: Bruce Momjian
Date:
Subject: SSL code fixed
Next
From: Bruce Momjian
Date:
Subject: Re: Memory Errors...