From b07e28c420395742e799cb2b2f1abb1d69510ecd Mon Sep 17 00:00:00 2001 From: Ziyang Hu Date: Fri, 20 Jan 2023 17:50:20 +0800 Subject: [PATCH] disallow destroying relations with indices --- cozo-core/src/runtime/relation.rs | 3 +++ 1 file changed, 3 insertions(+) diff --git a/cozo-core/src/runtime/relation.rs b/cozo-core/src/runtime/relation.rs index 005bb21b..6e6282ec 100644 --- a/cozo-core/src/runtime/relation.rs +++ b/cozo-core/src/runtime/relation.rs @@ -584,6 +584,9 @@ impl<'a> SessionTx<'a> { bail!("Cannot destroy temp relation"); } let store = self.get_relation(name, true)?; + if !stored.indices.is_empty() { + bail!("Cannot remove stored relation `{}` with indices attached.", name); + } if store.access_level < AccessLevel::Normal { bail!(InsufficientAccessLevel( store.name.to_string(),