Skip to content

Commit

Permalink
Merge pull request #7014 from red-soft-ru/5_0_fix_5082
Browse files Browse the repository at this point in the history
Fix #5082: Exception "too few key columns found for index" raises when attempt to create table with PK and immediatelly drop this PK within the same transaction
  • Loading branch information
dyemanov authored Oct 23, 2021
2 parents fbf9ed6 + 739cd56 commit 798db59
Showing 1 changed file with 7 additions and 7 deletions.
14 changes: 7 additions & 7 deletions src/jrd/dfw.epp
Original file line number Diff line number Diff line change
Expand Up @@ -3495,18 +3495,18 @@ static bool create_index(thread_db* tdbb, SSHORT phase, DeferredWork* work, jrd_
}
END_FOR

if (key_count != idx.idx_count)
if (!relation)
{
ERR_post(Arg::Gds(isc_no_meta_update) <<
Arg::Gds(isc_key_field_err) << Arg::Str(work->dfw_name));
// Msg352: too few key columns found for index %s (incorrect column name?)
// The record was not found in RDB$INDICES.
// Apparently the index was dropped in the same transaction.
return false;
}

if (!relation)
if (key_count != idx.idx_count)
{
ERR_post(Arg::Gds(isc_no_meta_update) <<
Arg::Gds(isc_idx_create_err) << Arg::Str(work->dfw_name));
// Msg308: can't create index %s
Arg::Gds(isc_key_field_err) << Arg::Str(work->dfw_name));
// Msg352: too few key columns found for index %s (incorrect column name?)
}

// Make sure the relation info is all current
Expand Down

0 comments on commit 798db59

Please sign in to comment.