Skip to content

Commit 777421c

Browse files
committed
feat: add UPDATE/DELETE support with cache invalidation (v0.4.0)
- Implement UPDATE statement with WHERE clause support - Implement DELETE statement with WHERE clause support - Add cache invalidation on write operations (INSERT/UPDATE/DELETE) - Fix projection-correct SELECT with column/alias validation - Add schema-safe INSERT/UPDATE with type coercion - Add comprehensive tests for new functionality - Update README and CHANGELOG for v0.4.0
1 parent f12e88c commit 777421c

14 files changed

Lines changed: 931 additions & 90 deletions

File tree

CHANGELOG.md

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,23 @@ All notable changes to NexumDB will be documented in this file.
55
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
66
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
77

8+
## [0.4.0] - 2026-02-03
9+
10+
### Added
11+
- Projection-aware SELECT with alias support
12+
- SHOW TABLES, DESCRIBE, and DROP TABLE (IF EXISTS)
13+
- Best-effort coercion for INSERT/UPDATE with schema validation
14+
- Full cache invalidation on data writes
15+
- Catalog persistence test coverage
16+
17+
### Changed
18+
- StorageEngine clone now shares underlying sled database
19+
- Semantic cache keys now include projection, WHERE, ORDER BY, LIMIT
20+
21+
### Tests
22+
- Added projection, coercion, and table management coverage
23+
- Extended integration tests for table lifecycle
24+
825
## [0.3.0] - 2025-11-26
926

1027
### Added
@@ -111,6 +128,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
111128
- 60x query speedup on cache hits
112129
- Local-only execution (no cloud dependencies)
113130

131+
[0.4.0]: https://github.com/aviralgarg05/NexumDB/compare/v0.3.0...v0.4.0
114132
[0.3.0]: https://github.com/aviralgarg05/NexumDB/compare/v0.2.0...v0.3.0
115133
[0.2.0]: https://github.com/aviralgarg05/NexumDB/compare/v0.1.0...v0.2.0
116134
[0.1.0]: https://github.com/aviralgarg05/NexumDB/releases/tag/v0.1.0

Cargo.lock

Lines changed: 2 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

README.md

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,12 @@ An innovative, open-source database that combines traditional SQL with AI-powere
1212

1313
## Features
1414

15+
### v0.4.0 - Core Correctness & Table Management
16+
- **Projection-Correct SELECT**: Column/alias projection with schema validation
17+
- **Schema-Safe Writes**: INSERT/UPDATE validation with best-effort coercion
18+
- **Table Management**: SHOW TABLES, DESCRIBE, DROP TABLE (IF EXISTS)
19+
- **Cache Safety**: Query cache keys include WHERE/ORDER/LIMIT + full invalidation on writes
20+
1521
### v0.3.0 - Advanced SQL & Persistent Learning
1622
- **Advanced SQL Operators**: LIKE (pattern matching), IN (list membership), BETWEEN (range queries)
1723
- **Query Modifiers**: ORDER BY (multi-column sorting), LIMIT (result truncation)
@@ -126,6 +132,8 @@ INSERT INTO users (id, name, age) VALUES (1, 'Alice', 30), (2, 'Bob', 25);
126132

127133
-- Simple query
128134
SELECT * FROM users;
135+
SELECT id, name FROM users;
136+
SELECT name AS display_name FROM users;
129137

130138
-- WHERE clause filtering (v0.2.0)
131139
SELECT * FROM users WHERE age > 25;
@@ -147,6 +155,15 @@ WHERE price BETWEEN 100 AND 500
147155
AND name LIKE 'L%'
148156
ORDER BY price DESC
149157
LIMIT 10;
158+
159+
-- Table management (v0.4.0)
160+
SHOW TABLES;
161+
DESCRIBE users;
162+
DROP TABLE IF EXISTS users;
163+
164+
-- Data modification (v0.4.0)
165+
UPDATE users SET age = 31 WHERE id = 1;
166+
DELETE FROM users WHERE id = 2;
150167
```
151168

152169
### Natural Language Queries (v0.2.0+)

nexum_cli/Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[package]
22
name = "nexum_cli"
3-
version = "0.3.0"
3+
version = "0.4.0"
44
edition = "2021"
55

66
[[bin]]

nexum_cli/src/main.rs

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ use nexum_core::{Catalog, Executor, NLTranslator, Parser, QueryExplainer, Storag
22
use std::io::{self, Write};
33

44
fn main() -> anyhow::Result<()> {
5-
println!("NexumDB v0.2.0 - AI-Native Database with Natural Language Support");
5+
println!("NexumDB v0.4.0 - AI-Native Database with Natural Language Support");
66
println!("Initializing...\n");
77

88
let storage = StorageEngine::new("./nexumdb_data")?;
@@ -32,7 +32,9 @@ fn main() -> anyhow::Result<()> {
3232
};
3333

3434
println!("Ready. Commands:");
35-
println!(" - SQL: Type any SQL query (CREATE TABLE, INSERT, SELECT)");
35+
println!(" - SQL: Type any SQL query (CREATE, INSERT, SELECT, UPDATE, DELETE, DROP)");
36+
println!(" - SHOW TABLES: List all tables");
37+
println!(" - DESCRIBE <table>: Show table schema");
3638
println!(" - ASK: Type 'ASK <question>' for natural language queries");
3739
println!(" - EXPLAIN: Type 'EXPLAIN <query>' to see query execution plan");
3840
println!(" - EXIT: Type 'exit' or 'quit' to exit\n");

nexum_core/Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[package]
22
name = "nexum_core"
3-
version = "0.3.0"
3+
version = "0.4.0"
44
edition = "2021"
55

66
[dependencies]

nexum_core/src/catalog/mod.rs

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -109,6 +109,7 @@ impl Catalog {
109109
mod tests {
110110
use super::*;
111111
use crate::sql::types::DataType;
112+
use tempfile::tempdir;
112113

113114
#[test]
114115
fn test_catalog_operations() {
@@ -139,4 +140,34 @@ mod tests {
139140
assert_eq!(tables.len(), 1);
140141
assert_eq!(tables[0], "users");
141142
}
143+
144+
#[test]
145+
fn test_catalog_persistence() {
146+
let temp_dir = tempdir().unwrap();
147+
let db_path = temp_dir.path().join("catalog_db");
148+
149+
{
150+
let storage = StorageEngine::new(&db_path).unwrap();
151+
let catalog = Catalog::new(storage);
152+
153+
let columns = vec![Column {
154+
name: "id".to_string(),
155+
data_type: DataType::Integer,
156+
}];
157+
158+
catalog.create_table("persist_table", columns).unwrap();
159+
}
160+
161+
{
162+
let storage = StorageEngine::new(&db_path).unwrap();
163+
let catalog = Catalog::new(storage);
164+
165+
let schema = catalog.get_table("persist_table").unwrap();
166+
assert!(schema.is_some());
167+
assert_eq!(schema.unwrap().name, "persist_table");
168+
169+
let tables = catalog.list_tables().unwrap();
170+
assert_eq!(tables, vec!["persist_table".to_string()]);
171+
}
172+
}
142173
}

0 commit comments

Comments
 (0)