Index: doc/src/sgml/config.sgml
===================================================================
RCS file: /cvsroot/pgsql/doc/src/sgml/config.sgml,v
retrieving revision 1.52
diff -c -c -r1.52 config.sgml
*** doc/src/sgml/config.sgml	10 Mar 2006 19:10:47 -0000	1.52
--- doc/src/sgml/config.sgml	18 Apr 2006 00:35:12 -0000
***************
*** 2758,2766 ****
         <note>
          <para>
           The <command>EXECUTE</command> statement is not considered a
!          <literal>ddl</> or <literal>mod</> statement.  When it is logged, 
!          only the name of the prepared statement is reported, not the
!          actual prepared statement.
          </para>
  
          <para>
--- 2758,2767 ----
         <note>
          <para>
           The <command>EXECUTE</command> statement is not considered a
!          <literal>ddl</> or <literal>mod</> statement.  Statements that
!          generate errors are not logged.  Set
!          <varname>log_min_error_statement</> to <literal>error</> to
!          log such statements.      
          </para>
  
          <para>
Index: src/backend/tcop/postgres.c
===================================================================
RCS file: /cvsroot/pgsql/src/backend/tcop/postgres.c,v
retrieving revision 1.483
diff -c -c -r1.483 postgres.c
*** src/backend/tcop/postgres.c	4 Apr 2006 19:35:35 -0000	1.483
--- src/backend/tcop/postgres.c	18 Apr 2006 00:35:21 -0000
***************
*** 586,604 ****
  
  		/*
  		 * For the first EXECUTE we find, record the client statement used by
! 		 * the PREPARE.
  		 */
  		if (IsA(parsetree, ExecuteStmt))
  		{
  			ExecuteStmt *stmt = (ExecuteStmt *) parsetree;
  			PreparedStatement *entry;
  
! 			if ((entry = FetchPreparedStatement(stmt->name, false)) != NULL &&
  				entry->query_string)
  			{
  				*prepare_string = palloc(strlen(entry->query_string) +
! 									  strlen("  [protocol PREPARE:  %s]") - 1);
! 				sprintf(*prepare_string, "  [protocol PREPARE:  %s]",
  						entry->query_string);
  			}
  		}
--- 586,606 ----
  
  		/*
  		 * For the first EXECUTE we find, record the client statement used by
! 		 * the PREPARE.  PREPARE doesn't save the parse tree so we have no
! 		 * way to conditionally output based on the type of query prepared.
  		 */
  		if (IsA(parsetree, ExecuteStmt))
  		{
  			ExecuteStmt *stmt = (ExecuteStmt *) parsetree;
  			PreparedStatement *entry;
  
! 			if (*prepare_string == NULL &&
! 				(entry = FetchPreparedStatement(stmt->name, false)) != NULL &&
  				entry->query_string)
  			{
  				*prepare_string = palloc(strlen(entry->query_string) +
! 									  strlen("  [PREPARE:  %s]") - 2 + 1);
! 				sprintf(*prepare_string, "  [PREPARE:  %s]",
  						entry->query_string);
  			}
  		}
