fix(wren): case-insensitive CTE name shadowing in CTERewriter#1489
fix(wren): case-insensitive CTE name shadowing in CTERewriter#1489goldmedal wants to merge 1 commit intoCanner:mainfrom
Conversation
_collect_user_cte_names() collected raw CTE names (e.g. "Orders")
while _collect_model_columns() compared against normalized/lowercased
table names ("orders"). The case-sensitive check missed the shadow,
generating a duplicate CTE. Lowercase names on collection to match
sqlglot's normalize_identifiers behavior.
Closes Canner#1479 (comment)
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: defaults Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (2)
📝 WalkthroughWalkthroughA case normalization fix for CTE (Common Table Expression) name comparison in the MDL rewriter. The Changes
Estimated code review effort🎯 2 (Simple) | ⏱️ ~10 minutes Suggested labels
Suggested reviewers
Poem
🚥 Pre-merge checks | ✅ 3✅ Passed checks (3 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
Summary
WITH Orders AS (...)vs modelorders)_collect_user_cte_names()now lowercases names to match sqlglot'snormalize_identifiersbehaviortest_user_cte_shadows_model_case_insensitivereproducing the exact scenario from feat(wren): CTE-based SQL planning with per-model expansion #1479 (comment)Addresses #1479 (comment)
Test plan
test_user_cte_shadows_model_case_insensitivepasses🤖 Generated with Claude Code
Summary by CodeRabbit