Skip to content

Commit

Permalink
Fixed bug CORE-2032 : Stored procedure recursively called by calculat…
Browse files Browse the repository at this point in the history
…ed field fails after reconnect
  • Loading branch information
hvlad committed Feb 3, 2021
1 parent 820fd7e commit b6b6897
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 1 deletion.
3 changes: 2 additions & 1 deletion src/dsql/ExprNodes.cpp
Expand Up @@ -6570,7 +6570,8 @@ ValueExprNode* FieldNode::pass1(thread_db* tdbb, CompilerScratch* csb)
jrd_rel* relation = tail->csb_relation;
jrd_fld* field;

if (!relation || !(field = MET_get_field(relation, fieldId)))
if (!relation || !(field = MET_get_field(relation, fieldId)) ||
(field->fld_flags & FLD_parse_computed))
{
if (relation && (relation->rel_flags & REL_being_scanned))
csb->csb_g_flags |= csb_reload;
Expand Down
3 changes: 3 additions & 0 deletions src/jrd/Relation.h
Expand Up @@ -474,6 +474,8 @@ inline jrd_rel::GCShared::~GCShared()

// Field block, one for each field in a scanned relation

const USHORT FLD_parse_computed = 0x0001; // computed expression is being parsed

class jrd_fld : public pool_alloc<type_fld>
{
public:
Expand All @@ -489,6 +491,7 @@ class jrd_fld : public pool_alloc<type_fld>
MetaName fld_generator_name; // identity generator name
MetaNamePair fld_source_rel_field; // Relation/field source name
Nullable<IdentityType> fld_identity_type;
USHORT fld_flags;

public:
explicit jrd_fld(MemoryPool& p)
Expand Down
2 changes: 2 additions & 0 deletions src/jrd/met.epp
Expand Up @@ -4072,6 +4072,8 @@ void MET_scan_relation(thread_db* tdbb, jrd_rel* relation)

case RSR_computed_blr:
{
AutoSetRestoreFlag<USHORT> flag(&field->fld_flags, FLD_parse_computed, true);

DmlNode* nod = dependencies ?
MET_get_dependencies(tdbb, relation, p, length, csb, NULL, NULL, NULL,
field->fld_name, obj_computed, 0, depTrans) :
Expand Down

0 comments on commit b6b6897

Please sign in to comment.