mirror of
https://github.com/FirebirdSQL/firebird.git
synced 2025-01-23 22:03:03 +01:00
Fixed CORE-5147 - Create trigger fails with ambiguous field name between table B and table A error.
This commit is contained in:
parent
955e6796f5
commit
e9eea07523
@ -3574,11 +3574,11 @@ void CreateAlterTriggerNode::compile(thread_db* /*tdbb*/, DsqlCompilerScratch* d
|
||||
|
||||
dsqlScratch->loopLevel = 0;
|
||||
dsqlScratch->cursorNumber = 0;
|
||||
dsqlScratch->scopeLevel++;
|
||||
|
||||
StmtNode* stmtNode = body->dsqlPass(dsqlScratch);
|
||||
GEN_hidden_variables(dsqlScratch);
|
||||
|
||||
dsqlScratch->scopeLevel++;
|
||||
// dimitr: I see no reason to deny EXIT command in triggers,
|
||||
// hence I've added zero label at the beginning.
|
||||
// My first suspicion regarding an obvious conflict
|
||||
|
@ -8036,7 +8036,7 @@ ValueExprNode* RecordKeyNode::dsqlPass(DsqlCompilerScratch* dsqlScratch)
|
||||
for (DsqlContextStack::iterator stack(*dsqlScratch->context); stack.hasData(); ++stack)
|
||||
{
|
||||
dsql_ctx* context = stack.object();
|
||||
if ((context->ctx_flags & CTX_system) ||
|
||||
if ((context->ctx_flags & (CTX_system | CTX_returning)) == CTX_system ||
|
||||
context->ctx_scope_level != dsqlScratch->scopeLevel)
|
||||
{
|
||||
continue;
|
||||
|
@ -135,7 +135,8 @@ namespace
|
||||
oldContext(aOldContext),
|
||||
oldAlias(oldContext->ctx_alias),
|
||||
oldInternalAlias(oldContext->ctx_internal_alias),
|
||||
autoFlags(&oldContext->ctx_flags, oldContext->ctx_flags | CTX_system | CTX_returning)
|
||||
autoFlags(&oldContext->ctx_flags, oldContext->ctx_flags | CTX_system | CTX_returning),
|
||||
autoScopeLevel(&aScratch->scopeLevel, aScratch->scopeLevel + 1)
|
||||
{
|
||||
// Clone the modify/old context and push with name "NEW" in a greater scope level.
|
||||
|
||||
@ -165,6 +166,7 @@ namespace
|
||||
|
||||
newContext->ctx_alias = newContext->ctx_internal_alias = NEW_CONTEXT_NAME;
|
||||
newContext->ctx_flags |= CTX_returning;
|
||||
newContext->ctx_scope_level = scratch->scopeLevel;
|
||||
scratch->context->push(newContext);
|
||||
}
|
||||
|
||||
@ -219,6 +221,7 @@ namespace
|
||||
dsql_ctx* oldContext;
|
||||
string oldAlias, oldInternalAlias;
|
||||
AutoSetRestore<USHORT> autoFlags;
|
||||
AutoSetRestore<USHORT> autoScopeLevel;
|
||||
};
|
||||
} // namespace
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user