From 1d2944cb9857cbb28b7e9f5aeb2dcd51e93cbee9 Mon Sep 17 00:00:00 2001 From: Adriano dos Santos Fernandes Date: Tue, 27 Oct 2020 12:59:47 -0300 Subject: [PATCH] Fixed CORE-6408 - RETURNING clause in MERGE cannot reference column in aliased target table using qualified reference (alias.column) if DELETE action present. --- src/dsql/StmtNodes.cpp | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/dsql/StmtNodes.cpp b/src/dsql/StmtNodes.cpp index ed79574f27..b44e70c0c8 100644 --- a/src/dsql/StmtNodes.cpp +++ b/src/dsql/StmtNodes.cpp @@ -156,6 +156,10 @@ namespace // Create the target (= OLD) context and push it on the stack. dsql_ctx* targetContext = FB_NEW_POOL(scratch->getPool()) dsql_ctx(scratch->getPool()); *targetContext = *oldContext; + + // ASF: dsql_ctx::operator= do not copy ctx_internal_alias. + targetContext->ctx_internal_alias = oldContext->ctx_internal_alias; + targetContext->ctx_flags &= ~CTX_system; // resolve unqualified fields scratch->context->push(targetContext);