MCPcopy Create free account
hub / github.com/erans/pgsqlite / test_update_delete_optimization

Function test_update_delete_optimization

tests/decimal_optimization_test.rs:146–169  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

144
145#[test]
146fn test_update_delete_optimization() {
147 let conn = setup_test_db();
148
149 // UPDATE on non-decimal table - should not be rewritten
150 let sql = "UPDATE users SET age = age + 1 WHERE active = 1";
151 let result = rewrite_query(&conn, sql).unwrap();
152 assert_eq!(result, "UPDATE users SET age = age + 1 WHERE active = 1");
153
154 // UPDATE on decimal table - should be rewritten
155 let sql = "UPDATE products SET price = price * 1.05 WHERE cost < 50";
156 let result = rewrite_query(&conn, sql).unwrap();
157 assert!(result.contains("decimal_mul"));
158 assert!(result.contains("decimal_lt"));
159
160 // DELETE on non-decimal table - should not be rewritten
161 let sql = "DELETE FROM users WHERE age < 18";
162 let result = rewrite_query(&conn, sql).unwrap();
163 assert_eq!(result, "DELETE FROM users WHERE age < 18");
164
165 // DELETE on decimal table - should be rewritten
166 let sql = "DELETE FROM products WHERE price > 1000";
167 let result = rewrite_query(&conn, sql).unwrap();
168 assert!(result.contains("decimal_gt"));
169}
170
171#[test]
172fn test_cte_optimization() {

Callers

nothing calls this directly

Calls 2

setup_test_dbFunction · 0.70
rewrite_queryFunction · 0.70

Tested by

no test coverage detected