From 5a1c18318fa2dc4e322d2c6d02afd7e93299b87f Mon Sep 17 00:00:00 2001 From: hzhang2 Date: Tue, 12 Apr 2016 16:30:46 +0800 Subject: [PATCH] try fix --- src/backend/executor/execMain.c | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/src/backend/executor/execMain.c b/src/backend/executor/execMain.c index 58d8d9bdd5..bb2e8b93f3 100644 --- a/src/backend/executor/execMain.c +++ b/src/backend/executor/execMain.c @@ -1360,6 +1360,12 @@ ExecutorEnd(QueryDesc *queryDesc) } PG_CATCH(); { + /* Cleanup the global resource reference for spi/function resource inheritate. */ + if (Gp_role == GP_ROLE_DISPATCH) { + AutoFreeResource(queryDesc->resource); + queryDesc->resource = NULL; + } + /* * we got an error. do all the necessary cleanup. */ @@ -1376,11 +1382,6 @@ ExecutorEnd(QueryDesc *queryDesc) */ FreeExecutorState(estate); - /* Cleanup the global resource reference for spi/function resource inheritate. */ - if (Gp_role == GP_ROLE_DISPATCH) { - AutoFreeResource(queryDesc->resource); - queryDesc->resource = NULL; - } PG_RE_THROW(); } PG_END_TRY();