Thread: Simple patch to report in log the schema name of the statement

Simple patch to report in log the schema name of the statement

From
Ferruccio Zamuner
Date:
./src/backend/utils/error/elog.c
*** ./src/backend/utils/error/elog.c.orig       Wed Aug  1 00:48:55 2007
--- ./src/backend/utils/error/elog.c    Wed Aug  1 00:53:16 2007
***************
*** 68,74 ****
--- 68,76 ----
  #include "storage/ipc.h"
  #include "tcop/tcopprot.h"
  #include "utils/memutils.h"
+ #include "utils/guc.h"
  #include "utils/ps_status.h"
+ #include "catalog/namespace.h"


  /* Global variables */
***************
*** 1541,1546 ****
--- 1543,1552 ----
                        case '%':
                                appendStringInfoChar(buf, '%');
                                break;
+                       case 'S':
+                               if (namespace_search_path != NULL)
+                                   appendStringInfo(buf, "%s ",
namespace_search_path);
+                                 break;
                        default:
                                /* format error - ignore it */
                                break;
./src/backend/utils/misc/postgresql.conf.sample
*** ./src/backend/utils/misc/postgresql.conf.sample.orig        Sat Jan
20 22:42:06 2007
--- ./src/backend/utils/misc/postgresql.conf.sample     Wed Aug  1
01:38:16 2007
***************
*** 328,333 ****
--- 330,336 ----
                                        #   %c = session id
                                        #   %l = session line number
                                        #   %s = session start timestamp
+                                       #   %S = schema
                                        #   %x = transaction id
                                        #   %q = stop here in non-session
                                        #        processes


Re: Simple patch to report in log the schema name of the statement

From
Tom Lane
Date:
Ferruccio Zamuner <nonsolosoft@diff.org> writes:
> [ patch with no documentation ]

I can hardly believe that it's a good idea to include search_path in
every log entry --- it'd be unreasonably bulky, not to mention impossible
to parse by automatic tools.

            regards, tom lane