8
0
mirror of https://github.com/FirebirdSQL/firebird.git synced 2025-01-23 21:23:03 +01:00

Fixed CORE-3806: Wrong data returned if a sub-query or a computed field refers to the base table in the ORDER BY clause.

This commit is contained in:
dimitr 2012-04-02 15:25:36 +00:00
parent b0749faa08
commit fe01201cd4

View File

@ -268,7 +268,7 @@ Sort* SortedStream::init(thread_db* tdbb) const
scb->sort(tdbb); scb->sort(tdbb);
// For the sake of prudence, set all record parameter blocks to contain // 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. // back to records by get_sort() have homes in the target record.
if (records) if (records)
@ -287,7 +287,10 @@ Sort* SortedStream::init(thread_db* tdbb) const
stream = item->stream; stream = item->stream;
record_param* const rpb = &request->req_rpb[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()); VIO_record(tdbb, rpb, MET_current(tdbb, rpb->rpb_relation), tdbb->getDefaultPool());
} }
} }