@@ -79,7 +79,7 @@ Function* Function::lookup(thread_db* tdbb, const QualifiedName& name, ObjectBas
7979 return MetadataCache::lookup_function(tdbb, name, flags);
8080}
8181
82- ScanResult Function::scan(thread_db* tdbb, ObjectBase::Flag)
82+ ScanResult Function::scan(thread_db* tdbb, ObjectBase::Flag flags )
8383{
8484 Attachment* attachment = tdbb->getAttachment();
8585 jrd_tra* metaTransaction = attachment->getMetaTransaction(tdbb);
@@ -335,23 +335,28 @@ ScanResult Function::scan(thread_db* tdbb, ObjectBase::Flag)
335335 }
336336 else if (!X.RDB$FUNCTION_BLR.NULL)
337337 {
338- const string name = getName().toQuotedString();
339-
340- try
341- {
342- TraceFuncCompile trace(tdbb, name);
343-
344- parseBlr(tdbb, csb, &X.RDB$FUNCTION_BLR,
345- X.RDB$DEBUG_INFO.NULL ? nullptr : &X.RDB$DEBUG_INFO);
346-
347- trace.finish(getStatement(), ITracePlugin::RESULT_SUCCESS);
348- }
349- catch (const Exception& ex)
338+ if (compiling || (flags & CacheFlag::MINISCAN))
339+ flReload = true;
340+ else
350341 {
351- StaticStatusVector temp_status;
352- ex.stuffException(temp_status);
353- (Arg::Gds(isc_bad_fun_BLR) << Arg::Str(name)
354- << Arg::StatusVector(temp_status.begin())).raise();
342+ const string name = getName().toQuotedString();
343+
344+ try
345+ {
346+ TraceFuncCompile trace(tdbb, name);
347+
348+ parseBlr(tdbb, csb, &X.RDB$FUNCTION_BLR,
349+ X.RDB$DEBUG_INFO.NULL ? nullptr : &X.RDB$DEBUG_INFO);
350+
351+ trace.finish(getStatement(), ITracePlugin::RESULT_SUCCESS);
352+ }
353+ catch (const Exception& ex)
354+ {
355+ StaticStatusVector temp_status;
356+ ex.stuffException(temp_status);
357+ (Arg::Gds(isc_bad_fun_BLR) << Arg::Str(name)
358+ << Arg::StatusVector(temp_status.begin())).raise();
359+ }
355360 }
356361 }
357362 }
@@ -361,7 +366,7 @@ ScanResult Function::scan(thread_db* tdbb, ObjectBase::Flag)
361366 throw;
362367 }
363368
364- fb_assert(!isDefined() || this == getStatement()->function);
369+ fb_assert(!isDefined() || flReload || this == getStatement()->function);
365370 }
366371 else
367372 {
@@ -371,7 +376,10 @@ ScanResult Function::scan(thread_db* tdbb, ObjectBase::Flag)
371376 RefPtr<MsgMetadata> outputMetadata(REF_NO_INCR, createMetadata(getOutputFields(), false));
372377 setOutputFormat(createFormat(pool, outputMetadata, true));
373378
374- setImplemented(false);
379+ if (compiling)
380+ flReload = true;
381+ else
382+ setImplemented(false);
375383 }
376384
377385 if (!dbb->readOnly() &&
0 commit comments