@@ -8368,7 +8368,9 @@ void AlterRelationNode::execute(thread_db* tdbb, DsqlCompilerScratch* dsqlScratc
83688368 strcmp(RC.RDB$CONSTRAINT_TYPE, UNIQUE_CNSTRT) == 0)
83698369 {
83708370 // Deactivation of primary/unique key requires check for active foreign keys
8371- checkIndexReferenced(tdbb, transaction, indexName);
8371+ if (!clause->enforced)
8372+ checkIndexReferenced(tdbb, transaction, indexName);
8373+
83728374 modifyIndex(tdbb, transaction, indexName, clause->enforced);
83738375 }
83748376 else if (strcmp(RC.RDB$CONSTRAINT_TYPE, FOREIGN_KEY) == 0)
@@ -10741,7 +10743,8 @@ void AlterIndexNode::execute(thread_db* tdbb, DsqlCompilerScratch* dsqlScratch,
1074110743
1074210744 executeDdlTrigger(tdbb, dsqlScratch, transaction, DTW_BEFORE, DDL_TRIGGER_ALTER_INDEX, name, {});
1074310745
10744- checkIndexReferenced(tdbb, transaction, name);
10746+ if (!active)
10747+ checkIndexReferenced(tdbb, transaction, name);
1074510748
1074610749 MODIFY IDX
1074710750 IDX.RDB$INDEX_INACTIVE.NULL = FALSE;
@@ -10755,7 +10758,7 @@ void AlterIndexNode::execute(thread_db* tdbb, DsqlCompilerScratch* dsqlScratch,
1075510758 else
1075610759 {
1075710760 // msg 48: "Index not found"
10758- status_exception::raise(Arg::PrivateDyn(48));
10761+ status_exception::raise(Arg::PrivateDyn(48) << Arg::Gds(isc_index_name) << name.toQuotedString() );
1075910762 }
1076010763
1076110764 savePoint.release(); // everything is ok
0 commit comments