diff --git a/src/jrd/recsrc/SortedStream.cpp b/src/jrd/recsrc/SortedStream.cpp index 7349d1ab09..ef2ac2b4e9 100644 --- a/src/jrd/recsrc/SortedStream.cpp +++ b/src/jrd/recsrc/SortedStream.cpp @@ -268,7 +268,7 @@ Sort* SortedStream::init(thread_db* tdbb) const scb->sort(tdbb); // For the sake of prudence, set all record parameter blocks to contain - // the most recent format. This will guarentee that all fields mapped + // the most recent format. This will guarantee that all fields mapped // back to records by get_sort() have homes in the target record. if (records) @@ -287,7 +287,10 @@ Sort* SortedStream::init(thread_db* tdbb) const stream = item->stream; record_param* const rpb = &request->req_rpb[stream]; - if (rpb->rpb_relation) + // dimitr: I've added the check for !isValid to ensure that we don't overwrite + // the format for an active rpb (i.e. the one having some record fetched). + // See CORE-3806 for example. + if (rpb->rpb_relation && !rpb->rpb_number.isValid()) VIO_record(tdbb, rpb, MET_current(tdbb, rpb->rpb_relation), tdbb->getDefaultPool()); } }