Index: src/backend/tcop/postgres.c
===================================================================
RCS file: /cvsroot/pgsql/src/backend/tcop/postgres.c,v
retrieving revision 1.501
diff -c -c -r1.501 postgres.c
*** src/backend/tcop/postgres.c	29 Aug 2006 02:32:41 -0000	1.501
--- src/backend/tcop/postgres.c	29 Aug 2006 19:54:08 -0000
***************
*** 1539,1555 ****
  										 -1);
  
  				/* Save the parameter values */
! 				appendStringInfo(&bind_values_str, "%s$%d = '",
  								 bind_values_str.len ? ", " : "",
  								 paramno + 1);
! 				for (p = pstring; *p; p++)
  				{
! 					if (*p == '\'')	/* double single quotes */
  						appendStringInfoChar(&bind_values_str, *p);
! 					appendStringInfoChar(&bind_values_str, *p);
  				}
! 				appendStringInfoChar(&bind_values_str, '\'');
! 
  				/* Free result of encoding conversion, if any */
  				if (pstring && pstring != pbuf.data)
  					pfree(pstring);
--- 1539,1561 ----
  										 -1);
  
  				/* Save the parameter values */
! 				appendStringInfo(&bind_values_str, "%s$%d = ",
  								 bind_values_str.len ? ", " : "",
  								 paramno + 1);
! 				if (pstring)
  				{
! 					appendStringInfoChar(&bind_values_str, '\'');
! 					for (p = pstring; *p; p++)
! 					{
! 						if (*p == '\'')	/* double single quotes */
! 							appendStringInfoChar(&bind_values_str, *p);
  						appendStringInfoChar(&bind_values_str, *p);
! 					}
! 					appendStringInfoChar(&bind_values_str, '\'');
  				}
! 				else
! 					appendStringInfo(&bind_values_str, "NULL");
! 				
  				/* Free result of encoding conversion, if any */
  				if (pstring && pstring != pbuf.data)
  					pfree(pstring);
***************
*** 1782,1788 ****
  						*portal_name ? portal_name : ""),
  						errdetail("prepare: %s%s%s", sourceText,
  						/* optionally print bind parameters */
! 						bindText ? "  bind: " : "",
  						bindText ? bindText : "")));
  
  	BeginCommand(portal->commandTag, dest);
--- 1788,1794 ----
  						*portal_name ? portal_name : ""),
  						errdetail("prepare: %s%s%s", sourceText,
  						/* optionally print bind parameters */
! 						bindText ? ",  bind: " : "",
  						bindText ? bindText : "")));
  
  	BeginCommand(portal->commandTag, dest);
***************
*** 1896,1902 ****
  								*portal_name ? portal_name : ""),
  								errdetail("prepare: %s%s%s", sourceText,
  								/* optionally print bind parameters */
! 								bindText ? "  bind: " : "",
  								bindText ? bindText : "")));
  		}
  	}
--- 1902,1908 ----
  								*portal_name ? portal_name : ""),
  								errdetail("prepare: %s%s%s", sourceText,
  								/* optionally print bind parameters */
! 								bindText ? ",  bind: " : "",
  								bindText ? bindText : "")));
  		}
  	}
