Skip to content

Commit d2cebfc

Browse files
committed
Merge pull request #8826 : Fixed potential endless loop inside MET_scan_relation
1 parent 985ea84 commit d2cebfc

File tree

1 file changed

+25
-0
lines changed

1 file changed

+25
-0
lines changed

src/jrd/met.epp

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3952,9 +3952,13 @@ static void scan_relation(thread_db* tdbb, jrd_rel* relation)
39523952
AutoCacheRequest request(tdbb, irq_r_fields, IRQ_REQUESTS);
39533953
CompilerScratch* csb = NULL;
39543954

3955+
bool found = false;
3956+
39553957
FOR(REQUEST_HANDLE request)
39563958
REL IN RDB$RELATIONS WITH REL.RDB$RELATION_ID EQ relation->rel_id
39573959
{
3960+
found = true;
3961+
39583962
// Pick up relation level stuff
39593963
relation->rel_current_fmt = REL.RDB$FORMAT;
39603964
vec<jrd_fld*>* vector = relation->rel_fields =
@@ -4228,6 +4232,27 @@ static void scan_relation(thread_db* tdbb, jrd_rel* relation)
42284232

42294233
delete csb;
42304234

4235+
if (!found && !(relation->rel_flags & REL_scanned))
4236+
{
4237+
// Relation was not found in RDB$RELATIONS. It could be system virtual relation
4238+
// defined in INI.
4239+
4240+
if (relation->isSystem() && relation->isVirtual())
4241+
{
4242+
relation->rel_flags |= REL_scanned;
4243+
}
4244+
else
4245+
{
4246+
fb_assert(false);
4247+
4248+
string name(relation->rel_name);
4249+
if (name.isEmpty())
4250+
name.printf("<ID = %u>", relation->rel_id);
4251+
4252+
ERR_post(Arg::Gds(isc_relnotdef) << Arg::Str(name));
4253+
}
4254+
}
4255+
42314256
// We have just loaded the triggers onto the local vector triggers.
42324257
// It's now time to place them at their rightful place inside the relation block.
42334258

0 commit comments

Comments
 (0)