Skip to content

Commit db410b7

Browse files
committed
Merge pull request #9061 from FirebirdSQL/work/gh-9059
Fixed bug #9059 : Weird violation of FOREIGN KEY for [var]binary datatype when PK and FK indices have opposite direction
1 parent fa5ffeb commit db410b7

1 file changed

Lines changed: 3 additions & 3 deletions

File tree

src/jrd/idx.cpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1935,6 +1935,9 @@ static idx_e check_partner_index(thread_db* tdbb,
19351935
// tmpIndex.idx_flags |= idx_unique;
19361936
tmpIndex.idx_flags = (tmpIndex.idx_flags & ~idx_unique) | (partner_idx.idx_flags & idx_unique);
19371937

1938+
// hvlad: The same about descending flag, it should be the same as in the partner index.
1939+
tmpIndex.idx_flags = (tmpIndex.idx_flags & ~idx_descending) | (partner_idx.idx_flags & idx_descending);
1940+
19381941
const auto keyType = starting ? INTL_KEY_PARTIAL :
19391942
(tmpIndex.idx_flags & idx_unique) ? INTL_KEY_UNIQUE : INTL_KEY_SORT;
19401943

@@ -1959,9 +1962,6 @@ static idx_e check_partner_index(thread_db* tdbb,
19591962
if (partner_idx.idx_flags & idx_descending)
19601963
retrieval.irb_generic |= irb_descending;
19611964

1962-
if ((idx->idx_flags & idx_descending) != (partner_idx.idx_flags & idx_descending))
1963-
BTR_complement_key(key);
1964-
19651965
RecordBitmap bm(*tdbb->getDefaultPool());
19661966
RecordBitmap* bitmap = &bm;
19671967
BTR_evaluate(tdbb, &retrieval, &bitmap, NULL);

0 commit comments

Comments
 (0)