pgmonitor patch for query string

Поиск
Список
Период
Сортировка
От Bruce Momjian
Тема pgmonitor patch for query string
Дата
Msg-id 200103141634.LAA06819@candle.pha.pa.us
обсуждение исходный текст
Ответы Re: pgmonitor patch for query string  (The Hermit Hacker <scrappy@hub.org>)
Re: pgmonitor patch for query string  (Peter Eisentraut <peter_e@gmx.net>)
Список pgsql-hackers
I would like to apply the following patch to the CVS tree.  It allows
pgmonitor to show query strings even if the backend is not compiled with
debug symbols.

It does this by creating a global variable 'debug_query_string' and
assigning it when the query begins and clearing it when the query ends.
It needs to be a global symbol so gdb can find it without debug symbols.

Seems like a very safe patch, and it allows pgmonitor to be much more
useful until we get a shared memory solution in 7.2.

Is this OK with everyone?

--
  Bruce Momjian                        |  http://candle.pha.pa.us
  pgman@candle.pha.pa.us               |  (610) 853-3000
  +  If your life is a hard drive,     |  830 Blythe Avenue
  +  Christ can be your backup.        |  Drexel Hill, Pennsylvania 19026
Index: src/backend/tcop/postgres.c
===================================================================
RCS file: /home/projects/pgsql/cvsroot/pgsql/src/backend/tcop/postgres.c,v
retrieving revision 1.211
diff -c -r1.211 postgres.c
*** src/backend/tcop/postgres.c    2001/03/14 15:14:35    1.211
--- src/backend/tcop/postgres.c    2001/03/14 16:29:26
***************
*** 74,79 ****
--- 74,81 ----
  extern int optind;
  extern char *optarg;

+ char *debug_query_string;        /* used by pgmonitor */
+
  /*
   * for ps display
   */
***************
*** 621,626 ****
--- 623,630 ----
      List       *parsetree_list,
                 *parsetree_item;

+     debug_query_string = query_string;    /* used by pgmonitor */
+
      /*
       * Start up a transaction command.  All queries generated by the
       * query_string will be in this same command block, *unless* we find
***************
*** 855,860 ****
--- 859,866 ----
       */
      if (xact_started)
          finish_xact_command();
+
+     debug_query_string = NULL;        /* used by pgmonitor */
  }

  /*
***************
*** 1718,1723 ****
--- 1724,1731 ----

      if (sigsetjmp(Warn_restart, 1) != 0)
      {
+         debug_query_string = NULL;        /* used by pgmonitor */
+
          /*
           * NOTE: if you are tempted to add more code in this if-block,
           * consider the probability that it should be in AbortTransaction()

В списке pgsql-hackers по дате отправления:

Предыдущее
От: Thomas Swan
Дата:
Сообщение: Re: AW: Shutdown term
Следующее
От: Peter Eisentraut
Дата:
Сообщение: Re: AW: Shutdown term