From 52a3dc04520bfcaa62f6682ae66c5c9eb9fb4878 Mon Sep 17 00:00:00 2001 From: "houzj.fnst" <63178771+sherlockcpp@users.noreply.github.com> Date: Fri, 31 Jul 2020 10:44:55 +0800 Subject: [PATCH] Update pool_relcache.c --- src/utils/pool_relcache.c | 16 ++++++++++++++-- 1 file changed, 14 insertions(+), 2 deletions(-) diff --git a/src/utils/pool_relcache.c b/src/utils/pool_relcache.c index e4b995f..f23d4e6 100644 --- a/src/utils/pool_relcache.c +++ b/src/utils/pool_relcache.c @@ -198,8 +198,20 @@ pool_search_relcache(POOL_RELCACHE * relcache, POOL_CONNECTION_POOL * backend, c } } - /* Not in cache. Check the system catalog */ - snprintf(query, sizeof(query), relcache->sql, table); + /* + * Not in cache. Check the system catalog + * + * The sql may have been formatted before. + * if FORMATTED flag exists, do not format sql again. + */ + if(strncmp(relcache->sql, "/*FORMATTED*/", 13) == 0) + { + strncpy(query, relcache->sql, sizeof(query) - 1); + } + else + { + snprintf(query, sizeof(query), relcache->sql, table); + } per_node_statement_log(backend, node_id, query); -- 1.8.3.1