Tom,

I'm currently resyncing my parser with the changes you made to
prepared statement logging. Everything is OK apart from an
inconsistency between log_duration and log_min_duration_statement.

* With log_duration, we have:
protocol : LOG:  statement: execute my_query: SELECT * FROM shop WHERE $1 = $2
query : LOG:  statement: EXECUTE test1('lop1', 'lop2')

* With log_min_duration_statement, we have:
protocol: LOG:  duration: 235.345 ms  execute insert_query: INSERT
INTO shop (name) VALUES($1)
query: LOG:  duration: 0.187 ms  statement: EXECUTE test1('lop1', 'lop2')

As you can see, in the log_duration case, we always have the
"statement: " part but we don't have it in log_min_duration_statement
case when using protocol.

I attached a patch to improve the consistency. It adds statement: for
every case. Note that statement was not there in the first version of
Bruce and he added it after so I keep it in this patch. I don't really
care if we have statement: or not but I'd really like a consistent
behaviour between both configuration.

Thanks,

--
Guillaume
Index: src/backend/tcop/postgres.c
===================================================================
RCS file: /projects/cvsroot/pgsql/src/backend/tcop/postgres.c,v
retrieving revision 1.508
diff -c -r1.508 postgres.c
*** src/backend/tcop/postgres.c	8 Sep 2006 15:55:53 -0000	1.508
--- src/backend/tcop/postgres.c	13 Sep 2006 12:44:16 -0000
***************
*** 1256,1262 ****
  			break;
  		case 2:
  			ereport(LOG,
! 					(errmsg("duration: %s ms  parse %s: %s",
  							msec_str,
  							*stmt_name ? stmt_name : "<unnamed>",
  							query_string)));
--- 1256,1262 ----
  			break;
  		case 2:
  			ereport(LOG,
! 					(errmsg("duration: %s ms  statement: parse %s: %s",
  							msec_str,
  							*stmt_name ? stmt_name : "<unnamed>",
  							query_string)));
***************
*** 1610,1616 ****
  			break;
  		case 2:
  			ereport(LOG,
! 					(errmsg("duration: %s ms  bind %s to %s: %s",
  							msec_str,
  							*portal_name ? portal_name : "<unnamed>",
  							*stmt_name ? stmt_name : "<unnamed>",
--- 1610,1616 ----
  			break;
  		case 2:
  			ereport(LOG,
! 					(errmsg("duration: %s ms  statement: bind %s to %s: %s",
  							msec_str,
  							*portal_name ? portal_name : "<unnamed>",
  							*stmt_name ? stmt_name : "<unnamed>",
***************
*** 1819,1825 ****
  			break;
  		case 2:
  			ereport(LOG,
! 					(errmsg("duration: %s ms  %s %s%s%s%s%s",
  							msec_str,
  							execute_is_fetch ?
  							_("execute fetch from") :
--- 1819,1825 ----
  			break;
  		case 2:
  			ereport(LOG,
! 					(errmsg("duration: %s ms  statement: %s %s%s%s%s%s",
  							msec_str,
  							execute_is_fetch ?
  							_("execute fetch from") :
---------------------------(end of broadcast)---------------------------
TIP 3: Have you checked our extensive FAQ?

               http://www.postgresql.org/docs/faq

Reply via email to