From c1300e1ee851706fa9b83e8ea86d9cc41f3d51a9 Mon Sep 17 00:00:00 2001 From: Vladimir Sitnikov Date: Mon, 1 Aug 2016 15:04:08 +0300 Subject: [PATCH] WIP: try CreateOneShotCachedPlan for unnamed statements in exec_parse_message Note: this change would probably fail "parse, bind, exec, bind, exec" kind of scenario, however `make check` passes. --- src/backend/tcop/postgres.c | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/src/backend/tcop/postgres.c b/src/backend/tcop/postgres.c index b185c1b..8e5aa43 100644 --- a/src/backend/tcop/postgres.c +++ b/src/backend/tcop/postgres.c @@ -1308,7 +1308,11 @@ exec_parse_message(const char *query_string, /* string to execute */ * Create the CachedPlanSource before we do parse analysis, since it * needs to see the unmodified raw parse tree. */ - psrc = CreateCachedPlan(raw_parse_tree, query_string, commandTag); + if (is_named) { + psrc = CreateCachedPlan(raw_parse_tree, query_string, commandTag); + } else { + psrc = CreateOneShotCachedPlan(raw_parse_tree, query_string, commandTag); + } /* * Set up a snapshot if parse analysis will need one. @@ -1399,7 +1403,7 @@ exec_parse_message(const char *query_string, /* string to execute */ /* * We just save the CachedPlanSource into unnamed_stmt_psrc. */ - SaveCachedPlan(psrc); + // SaveCachedPlan(psrc); unnamed_stmt_psrc = psrc; } -- 2.9.1