pgpool2.git / summary / log / commit / refs
commit 13878e7aa40478deb34400535f21e3bfe80d4b6d
Author: Tatsuo Ishii <ishii@postgresql.org>
Date: Thu Jul 05 07:12:22 2012 +0000
Fix function call case. Before it did not change memory context
before calling raw_parser. This will make trouble afterward if
default pool_memory context is destroyed.
pool_proto_modules.c | 4 ++++
1 file changed, 4 insertions(+)
diff --git a/pool_proto_modules.c b/pool_proto_modules.c
index cf208addf..a6356d936 100644
--- a/pool_proto_modules.c
+++ b/pool_proto_modules.c
@@ -2389,6 +2389,7 @@ POOL_STATUS ProcessFrontendResponse(POOL_CONNECTION *frontend,
char *query;
Node *node;
List *parse_tree_list;
+ POOL_MEMORY_POOL *old_context;
case 'X': /* Terminate */
return POOL_END;
@@ -2453,6 +2454,7 @@ POOL_STATUS ProcessFrontendResponse(POOL_CONNECTION *frontend,
pool_error("ProcessFrontendResponse: pool_init_query_context failed");
return POOL_END;
}
+ old_context = pool_memory_context_switch_to(query_context->memory_context);
query = "INSERT INTO foo VALUES(1)";
parse_tree_list = raw_parser(query);
node = (Node *) lfirst(list_head(parse_tree_list));
@@ -2464,6 +2466,8 @@ POOL_STATUS ProcessFrontendResponse(POOL_CONNECTION *frontend,
status = FunctionCall3(frontend, backend, len, contents);
else
status = FunctionCall(frontend, backend);
+
+ pool_memory_context_switch_to(old_context);
break;
case 'c': /* CopyDone */
[parent: 255a91d8ec4c]