Skip to content

Commit 704d8ce

Browse files
authored
Merge pull request #8826 from FirebirdSQL/work/met_check_sysrel_ods
Fixed potential endless loop inside MET_scan_relation
2 parents b103e8f + 9ca15be commit 704d8ce

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
@@ -4095,9 +4095,13 @@ static void scan_relation(thread_db* tdbb, jrd_rel* relation)
40954095
AutoCacheRequest request(tdbb, irq_r_fields, IRQ_REQUESTS);
40964096
CompilerScratch* csb = NULL;
40974097

4098+
bool found = false;
4099+
40984100
FOR(REQUEST_HANDLE request)
40994101
REL IN RDB$RELATIONS WITH REL.RDB$RELATION_ID EQ relation->rel_id
41004102
{
4103+
found = true;
4104+
41014105
// Pick up relation level stuff
41024106
relation->rel_current_fmt = REL.RDB$FORMAT;
41034107
vec<jrd_fld*>* vector = relation->rel_fields =
@@ -4371,6 +4375,27 @@ static void scan_relation(thread_db* tdbb, jrd_rel* relation)
43714375

43724376
delete csb;
43734377

4378+
if (!found && !(relation->rel_flags & REL_scanned))
4379+
{
4380+
// Relation was not found in RDB$RELATIONS. It could be system virtual relation
4381+
// defined in INI.
4382+
4383+
if (relation->isSystem() && relation->isVirtual())
4384+
{
4385+
relation->rel_flags |= REL_scanned;
4386+
}
4387+
else
4388+
{
4389+
fb_assert(false);
4390+
4391+
string name(relation->rel_name);
4392+
if (name.isEmpty())
4393+
name.printf("<ID = %u>", relation->rel_id);
4394+
4395+
ERR_post(Arg::Gds(isc_relnotdef) << Arg::Str(name));
4396+
}
4397+
}
4398+
43744399
// We have just loaded the triggers onto the local vector triggers.
43754400
// It's now time to place them at their rightful place inside the relation block.
43764401

0 commit comments

Comments
 (0)