()
| 244 | |
| 245 | #[test] |
| 246 | fn test_nested_ctes() { |
| 247 | let conn = setup_test_db(); |
| 248 | |
| 249 | let sql = "WITH RECURSIVE |
| 250 | order_hierarchy AS ( |
| 251 | SELECT id, total, 1 as level |
| 252 | FROM orders |
| 253 | WHERE customer_id = 1 |
| 254 | |
| 255 | UNION ALL |
| 256 | |
| 257 | SELECT o.id, o.total + oh.total, oh.level + 1 |
| 258 | FROM orders o |
| 259 | JOIN order_hierarchy oh ON o.customer_id = 1 |
| 260 | WHERE oh.level < 5 |
| 261 | ) |
| 262 | SELECT level, total |
| 263 | FROM order_hierarchy"; |
| 264 | let result = rewrite_query(&conn, sql).unwrap(); |
| 265 | |
| 266 | println!("Recursive CTE rewritten to: {result}"); |
| 267 | |
| 268 | // Recursive CTEs should still have decimal operations rewritten |
| 269 | assert!(result.contains("decimal_add")); |
| 270 | } |
| 271 | |
| 272 | #[test] |
| 273 | fn test_subquery_in_where_clause() { |
nothing calls this directly
no test coverage detected