Skip to content

Commit b6e5c4a

Browse files
committed
Fix log_statement to properly recognize SELECT INTO and CREATE TABLE AS
and DDL statements. Backpatch fix to 8.0.X. Per report from Murthy Kambhampaty
1 parent 1e85fa2 commit b6e5c4a

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

src/backend/tcop/postgres.c

Lines changed: 4 additions & 2 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.444 2005/05/24 04:18:04 momjian Exp $
11+
* $PostgreSQL: pgsql/src/backend/tcop/postgres.c,v 1.445 2005/06/01 23:27:03 momjian Exp $
1212
*
1313
* NOTES
1414
* this is the "main" module of the postgres backend and
@@ -498,7 +498,8 @@ log_after_parse(List *raw_parsetree_list, const char *query_string,
498498
if (IsA(parsetree, PrepareStmt))
499499
parsetree = (Node *) (((PrepareStmt *) parsetree)->query);
500500

501-
if (IsA(parsetree, SelectStmt))
501+
if (IsA(parsetree, SelectStmt) &&
502+
((SelectStmt *) parsetree)->into == NULL)
502503
continue; /* optimization for frequent command */
503504

504505
if (log_statement == LOGSTMT_MOD &&
@@ -514,6 +515,7 @@ log_after_parse(List *raw_parsetree_list, const char *query_string,
514515
if ((log_statement == LOGSTMT_MOD ||
515516
log_statement == LOGSTMT_DDL) &&
516517
(strncmp(commandTag, "CREATE ", strlen("CREATE ")) == 0 ||
518+
IsA(parsetree, SelectStmt) || /* SELECT INTO, CREATE AS */
517519
strncmp(commandTag, "ALTER ", strlen("ALTER ")) == 0 ||
518520
strncmp(commandTag, "DROP ", strlen("DROP ")) == 0 ||
519521
IsA(parsetree, GrantStmt) || /* GRANT or REVOKE */

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy