Location via proxy:   [ UP ]  
[Report a bug]   [Manage cookies]                
Skip to content

Commit 5bd59b9

Browse files
committed
Document that errors are not output by log_statement (was they were in
8.0), and add as suggestion to use log_min_error_statement for this purpose. I also fixed the code so the first EXECUTE has it's prepare, rather than the last which is what was in the current code. Also remove "protocol" prefix for SQL EXECUTE output because it is not accurate. Backpatch to 8.1.X.
1 parent 0a87394 commit 5bd59b9

File tree

2 files changed

+12
-9
lines changed

2 files changed

+12
-9
lines changed

doc/src/sgml/config.sgml

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
<!-- $PostgreSQL: pgsql/doc/src/sgml/config.sgml,v 1.52 2006/03/10 19:10:47 momjian Exp $ -->
1+
<!-- $PostgreSQL: pgsql/doc/src/sgml/config.sgml,v 1.53 2006/04/18 00:52:22 momjian Exp $ -->
22

33
<chapter Id="runtime-config">
44
<title>Server Configuration</title>
@@ -2758,9 +2758,10 @@ SELECT * FROM parent WHERE key = 2400;
27582758
<note>
27592759
<para>
27602760
The <command>EXECUTE</command> statement is not considered a
2761-
<literal>ddl</> or <literal>mod</> statement. When it is logged,
2762-
only the name of the prepared statement is reported, not the
2763-
actual prepared statement.
2761+
<literal>ddl</> or <literal>mod</> statement. Statements that
2762+
generate errors are not logged. Set
2763+
<varname>log_min_error_statement</> to <literal>error</> to
2764+
log such statements.
27642765
</para>
27652766

27662767
<para>

src/backend/tcop/postgres.c

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
*
99
*
1010
* IDENTIFICATION
11-
* $PostgreSQL: pgsql/src/backend/tcop/postgres.c,v 1.483 2006/04/04 19:35:35 tgl Exp $
11+
* $PostgreSQL: pgsql/src/backend/tcop/postgres.c,v 1.484 2006/04/18 00:52:23 momjian Exp $
1212
*
1313
* NOTES
1414
* this is the "main" module of the postgres backend and
@@ -586,19 +586,21 @@ log_after_parse(List *raw_parsetree_list, const char *query_string,
586586

587587
/*
588588
* For the first EXECUTE we find, record the client statement used by
589-
* the PREPARE.
589+
* the PREPARE. PREPARE doesn't save the parse tree so we have no
590+
* way to conditionally output based on the type of query prepared.
590591
*/
591592
if (IsA(parsetree, ExecuteStmt))
592593
{
593594
ExecuteStmt *stmt = (ExecuteStmt *) parsetree;
594595
PreparedStatement *entry;
595596

596-
if ((entry = FetchPreparedStatement(stmt->name, false)) != NULL &&
597+
if (*prepare_string == NULL &&
598+
(entry = FetchPreparedStatement(stmt->name, false)) != NULL &&
597599
entry->query_string)
598600
{
599601
*prepare_string = palloc(strlen(entry->query_string) +
600-
strlen(" [protocol PREPARE: %s]") - 1);
601-
sprintf(*prepare_string, " [protocol PREPARE: %s]",
602+
strlen(" [PREPARE: %s]") - 2 + 1);
603+
sprintf(*prepare_string, " [PREPARE: %s]",
602604
entry->query_string);
603605
}
604606
}

0 commit comments

Comments
 (0)