HAWQ-629. Insert into table select generate_series free resource too early.
Project: http://git-wip-us.apache.org/repos/asf/incubator-hawq/repo Commit: http://git-wip-us.apache.org/repos/asf/incubator-hawq/commit/0aa69529 Tree: http://git-wip-us.apache.org/repos/asf/incubator-hawq/tree/0aa69529 Diff: http://git-wip-us.apache.org/repos/asf/incubator-hawq/diff/0aa69529 Branch: refs/heads/HAWQ-617 Commit: 0aa6952930e6f7d155624947dbb612e1516b0a00 Parents: 1fbdf8b Author: hzhang2 <zhanghuan...@163.com> Authored: Wed Apr 6 10:59:15 2016 +0800 Committer: hzhang2 <zhanghuan...@163.com> Committed: Wed Apr 6 11:00:07 2016 +0800 ---------------------------------------------------------------------- src/backend/executor/execMain.c | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/incubator-hawq/blob/0aa69529/src/backend/executor/execMain.c ---------------------------------------------------------------------- diff --git a/src/backend/executor/execMain.c b/src/backend/executor/execMain.c index 6fa5cd2..cc030be 100644 --- a/src/backend/executor/execMain.c +++ b/src/backend/executor/execMain.c @@ -1306,12 +1306,6 @@ ExecutorEnd(QueryDesc *queryDesc) /* sanity checks */ Assert(queryDesc != NULL); - /* Cleanup the global resource reference for spi/function resource inheritate. */ - if ( Gp_role == GP_ROLE_DISPATCH ) { - AutoFreeResource(queryDesc->resource); - queryDesc->resource = NULL; - } - estate = queryDesc->estate; Assert(estate != NULL); @@ -1386,6 +1380,12 @@ ExecutorEnd(QueryDesc *queryDesc) } PG_END_TRY(); + /* Cleanup the global resource reference for spi/function resource inheritate. */ + if ( Gp_role == GP_ROLE_DISPATCH ) { + AutoFreeResource(queryDesc->resource); + queryDesc->resource = NULL; + } + /* * If normal termination, let each operator clean itself up. * Otherwise don't risk it... an error might have left some