? GNUmakefile
? config.log
? config.status
? src/Makefile.global
? src/include/pg_config.h
? src/include/stamp-h
? src/interfaces/ecpg/include/ecpg_config.h
Index: src/backend/tcop/postgres.c
===================================================================
RCS file: /projects/cvsroot/pgsql/src/backend/tcop/postgres.c,v
retrieving revision 1.555
diff -c -r1.555 postgres.c
*** src/backend/tcop/postgres.c	1 Aug 2008 13:16:09 -0000	1.555
--- src/backend/tcop/postgres.c	15 Aug 2008 07:35:54 -0000
***************
*** 80,86 ****
   *		global variables
   * ----------------
   */
! const char *debug_query_string; /* for pgmonitor and log_min_error_statement */
  
  /* Note: whereToSendOutput is initialized for the bootstrap/standalone case */
  CommandDest whereToSendOutput = DestDebug;
--- 80,88 ----
   *		global variables
   * ----------------
   */
! /* for pgmonitor and log_min_error_statement */
! const char          *debug_query_string;
! ParamListInfo debug_param_list;
  
  /* Note: whereToSendOutput is initialized for the bootstrap/standalone case */
  CommandDest whereToSendOutput = DestDebug;
***************
*** 1628,1633 ****
--- 1630,1640 ----
  	else
  		params = NULL;
  
+ 	/*
+ 	 * Report param to various monitoring facilities
+ 	 */
+ 	debug_param_list = params;
+ 
  	/* Done storing stuff in portal's context */
  	MemoryContextSwitchTo(oldContext);
  
***************
*** 1740,1745 ****
--- 1747,1753 ----
  		ShowUsage("BIND MESSAGE STATISTICS");
  
  	debug_query_string = NULL;
+ 	debug_param_list = NULL;
  }
  
  /*
***************
*** 1822,1827 ****
--- 1830,1836 ----
  	 * Report query to various monitoring facilities.
  	 */
  	debug_query_string = sourceText;
+ 	debug_param_list = portalParams;
  
  	pgstat_report_activity(sourceText);
  
***************
*** 1957,1962 ****
--- 1966,1972 ----
  		ShowUsage("EXECUTE MESSAGE STATISTICS");
  
  	debug_query_string = NULL;
+ 	debug_param_list = NULL;
  }
  
  /*
***************
*** 2075,2080 ****
--- 2085,2135 ----
  }
  
  /*
+  * appendParamStringInfo
+  *
+  * Append bind-parameter data to the StringInfo buffer.
+  */
+ void
+ append_param_list(StringInfo buf, ParamListInfo params)
+ {
+   int paramno;
+ 
+   for (paramno = 0; paramno < params->numParams; paramno++)
+   {
+     ParamExternData *prm = &params->params[paramno];
+     Oid			typoutput;
+     bool		typisvarlena;
+     char	   *pstring;
+     char	   *p;
+     
+     appendStringInfo(buf, "%s$%d = ",
+ 		     paramno > 0 ? ", " : "",
+ 		     paramno + 1);
+     
+     if (prm->isnull || !OidIsValid(prm->ptype))
+       {
+ 	appendStringInfoString(buf, "NULL");
+ 	continue;
+       }
+     
+     getTypeOutputInfo(prm->ptype, &typoutput, &typisvarlena);
+     
+     pstring = OidOutputFunctionCall(typoutput, prm->value);
+     
+     appendStringInfoCharMacro(buf, '\'');
+     for (p = pstring; *p; p++)
+       {
+ 	if (*p == '\'') /* double single quotes */
+ 	  appendStringInfoCharMacro(buf, *p);
+ 	appendStringInfoCharMacro(buf, *p);
+       }
+     appendStringInfoCharMacro(buf, '\'');
+     
+     pfree(pstring);
+   }
+ }
+ 
+ /*
   * errdetail_params
   *
   * Add an errdetail() line showing bind-parameter data, if available.
***************
*** 2087,2132 ****
  	{
  		StringInfoData param_str;
  		MemoryContext oldcontext;
- 		int			paramno;
  
  		/* Make sure any trash is generated in MessageContext */
  		oldcontext = MemoryContextSwitchTo(MessageContext);
  
  		initStringInfo(&param_str);
  
! 		for (paramno = 0; paramno < params->numParams; paramno++)
! 		{
! 			ParamExternData *prm = &params->params[paramno];
! 			Oid			typoutput;
! 			bool		typisvarlena;
! 			char	   *pstring;
! 			char	   *p;
! 
! 			appendStringInfo(&param_str, "%s$%d = ",
! 							 paramno > 0 ? ", " : "",
! 							 paramno + 1);
! 
! 			if (prm->isnull || !OidIsValid(prm->ptype))
! 			{
! 				appendStringInfoString(&param_str, "NULL");
! 				continue;
! 			}
! 
! 			getTypeOutputInfo(prm->ptype, &typoutput, &typisvarlena);
! 
! 			pstring = OidOutputFunctionCall(typoutput, prm->value);
! 
! 			appendStringInfoCharMacro(&param_str, '\'');
! 			for (p = pstring; *p; p++)
! 			{
! 				if (*p == '\'') /* double single quotes */
! 					appendStringInfoCharMacro(&param_str, *p);
! 				appendStringInfoCharMacro(&param_str, *p);
! 			}
! 			appendStringInfoCharMacro(&param_str, '\'');
! 
! 			pfree(pstring);
! 		}
  
  		errdetail("parameters: %s", param_str.data);
  
--- 2142,2155 ----
  	{
  		StringInfoData param_str;
  		MemoryContext oldcontext;
  
  		/* Make sure any trash is generated in MessageContext */
  		oldcontext = MemoryContextSwitchTo(MessageContext);
  
  		initStringInfo(&param_str);
  
! 		/* Append bind-parameter data to the StringInfo buffer */
! 		append_param_list(&param_str, params);
  
  		errdetail("parameters: %s", param_str.data);
  
***************
*** 3434,3443 ****
  		EmitErrorReport();
  
  		/*
! 		 * Make sure debug_query_string gets reset before we possibly clobber
! 		 * the storage it points at.
  		 */
  		debug_query_string = NULL;
  
  		/*
  		 * Abort the current transaction in order to recover.
--- 3457,3467 ----
  		EmitErrorReport();
  
  		/*
! 		 * Make sure debug_query_string and debug_param_list get reset 
! 		 * before we possibly clobber the storage it points at.
  		 */
  		debug_query_string = NULL;
+ 		debug_param_list = NULL;
  
  		/*
  		 * Abort the current transaction in order to recover.
Index: src/backend/utils/error/elog.c
===================================================================
RCS file: /projects/cvsroot/pgsql/src/backend/utils/error/elog.c,v
retrieving revision 1.205
diff -c -r1.205 elog.c
*** src/backend/utils/error/elog.c	9 Jul 2008 15:56:49 -0000	1.205
--- src/backend/utils/error/elog.c	15 Aug 2008 07:35:55 -0000
***************
*** 268,273 ****
--- 268,274 ----
  		{
  			error_context_stack = NULL;
  			debug_query_string = NULL;
+ 			debug_param_list = NULL;
  		}
  	}
  	if (++errordata_stack_depth >= ERRORDATA_STACK_SIZE)
***************
*** 2012,2017 ****
--- 2013,2025 ----
  		appendStringInfoString(&buf, _("STATEMENT:  "));
  		append_with_tabs(&buf, debug_query_string);
  		appendStringInfoChar(&buf, '\n');
+ 
+ 		if (debug_param_list && debug_param_list->numParams > 0)
+ 		  {
+ 		    appendStringInfoString(&buf, _("DETAIL:  parameters: "));
+ 		    append_param_list(&buf, debug_param_list);
+ 		    appendStringInfoChar(&buf, '\n');
+ 		  }
  	}
  
  #ifdef HAVE_SYSLOG
Index: src/include/tcop/tcopprot.h
===================================================================
RCS file: /projects/cvsroot/pgsql/src/include/tcop/tcopprot.h,v
retrieving revision 1.93
diff -c -r1.93 tcopprot.h
*** src/include/tcop/tcopprot.h	10 Mar 2008 12:55:13 -0000	1.93
--- src/include/tcop/tcopprot.h	15 Aug 2008 07:35:55 -0000
***************
*** 29,34 ****
--- 29,35 ----
  
  extern CommandDest whereToSendOutput;
  extern PGDLLIMPORT const char *debug_query_string;
+ extern ParamListInfo debug_param_list;
  extern int	max_stack_depth;
  extern int	PostAuthDelay;
  
***************
*** 68,73 ****
--- 69,75 ----
  extern void ResetUsage(void);
  extern void ShowUsage(const char *title);
  extern int	check_log_duration(char *msec_str, bool was_logged);
+ extern void append_param_list(StringInfo buf, ParamListInfo params);
  extern void set_debug_options(int debug_flag,
  				  GucContext context, GucSource source);
  extern bool set_plan_disabling_options(const char *arg,