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

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

This commit also fixes #5173 and #3886.
The situation when the record is not found in RDB$INDICES was not handled correctly in create_index DFW.
This commit is contained in:
Ilya Eremin 2021-10-19 15:34:28 +03:00
parent 35ee143b65
commit 739cd56670

View File

@ -3495,6 +3495,13 @@ static bool create_index(thread_db* tdbb, SSHORT phase, DeferredWork* work, jrd_
}
END_FOR
if (!relation)
{
// The record was not found in RDB$INDICES.
// Apparently the index was dropped in the same transaction.
return false;
}
if (key_count != idx.idx_count)
{
ERR_post(Arg::Gds(isc_no_meta_update) <<
@ -3502,13 +3509,6 @@ static bool create_index(thread_db* tdbb, SSHORT phase, DeferredWork* work, jrd_
// Msg352: too few key columns found for index %s (incorrect column name?)
}
if (!relation)
{
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
}
// Make sure the relation info is all current
MET_scan_relation(tdbb, relation);