From f49575d547a0e7010b136fecddabdc737bfa0770 Mon Sep 17 00:00:00 2001 From: rajajisai Date: Tue, 5 Aug 2025 21:17:25 -0700 Subject: [PATCH] Return error when trying to drop an index associated with UNIQUE or PRIMARY KEY constraints --- core/translate/index.rs | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/core/translate/index.rs b/core/translate/index.rs index 3041e431f..a82cccf68 100644 --- a/core/translate/index.rs +++ b/core/translate/index.rs @@ -343,6 +343,15 @@ pub fn translate_drop_index( ))); } } + // Return an error if the index is an unique or primary key. + if let Some(idx) = maybe_index { + if idx.unique { + return Err(crate::error::LimboError::InvalidArgument( + "index associated with UNIQUE or PRIMARY KEY constraint cannot be dropped" + .to_string(), + )); + } + } // According to sqlite should emit Null instruction // but why?