diff --git a/src/jrd/irq.h b/src/jrd/irq.h index 8f4456f665..185fbc2b96 100644 --- a/src/jrd/irq.h +++ b/src/jrd/irq.h @@ -154,6 +154,7 @@ enum irq_type_t irq_default_cs, // DSQL/METD: lookup the default charset irq_rel_ids, // DSQL/METD: check relation/field ids irq_comp_circ_dpd, // check computed circular dependencies + irq_l_curr_format, // lookup table's current format irq_MAX }; diff --git a/src/jrd/met.epp b/src/jrd/met.epp index 967c8cd5e1..1ceff8bd1a 100644 --- a/src/jrd/met.epp +++ b/src/jrd/met.epp @@ -956,8 +956,29 @@ Format* MET_current(thread_db* tdbb, jrd_rel* relation) return relation->rel_current_format; SET_TDBB(tdbb); + Database* dbb = tdbb->getDatabase(); - return relation->rel_current_format = MET_format(tdbb, relation, relation->rel_current_fmt); + if (!(relation->rel_flags & REL_scanned)) + { + jrd_req* request = CMP_find_request(tdbb, irq_l_curr_format, IRQ_REQUESTS); + + FOR(REQUEST_HANDLE request) + REL IN RDB$RELATIONS WITH REL.RDB$RELATION_ID EQ relation->rel_id + { + if (!REQUEST(irq_l_curr_format)) + REQUEST(irq_l_curr_format) = request; + + relation->rel_current_fmt = REL.RDB$FORMAT; + } + END_FOR + + if (!REQUEST(irq_l_curr_format)) + REQUEST(irq_l_curr_format) = request; + } + + relation->rel_current_format = MET_format(tdbb, relation, relation->rel_current_fmt); + + return relation->rel_current_format; }