-
Notifications
You must be signed in to change notification settings - Fork 1
Bugfix queryable execute nil return #61
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
Both STRICT tables and generated/computed columns are already fully implemented: ✅ el-z8u: STRICT Tables - create table(:users, strict: true) works ✅ el-ik6: Generated Columns - GENERATED ALWAYS AS syntax supported with STORED option All tests pass. These features are production-ready.
Verified and marked as complete: ✅ el-4oc: R*Tree Spatial Indexing - create table(:locations, rtree: true) works ✅ el-o8r: Partial Index Support - CREATE INDEX with WHERE clause works ✅ el-0ez: RANDOM ROWID Support - create table(:sessions, random_rowid: true) works All tests pass. Features are production-ready.
Fix Protocol.UndefinedError when queries start with SQL comments (e.g., "-- comment\nSELECT ..."). Both single-line (--) and block (/* */) comments are now correctly skipped before detecting the query type. Root cause: When a SELECT query started with a comment, both the Rust should_use_query() and Elixir detect_command() functions would not recognise it as a SELECT, causing the query to be routed through the execute path which sets rows to nil. Ecto then failed when trying to enumerate over nil rows. Changes: - Add skip_whitespace_and_comments() helper in Rust utils.rs - Add skip_leading_comments_and_whitespace() helper in Elixir native.ex - Update tests to verify comment handling works correctly
WalkthroughAdds SQL comment-skipping to query-type detection in Elixir and Rust so statements beginning with Changes
Estimated code review effort🎯 4 (Complex) | ⏱️ ~45 minutes Possibly related PRs
Poem
🚥 Pre-merge checks | ✅ 2 | ❌ 1❌ Failed checks (1 inconclusive)
✅ Passed checks (2 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 |
When using update_all/delete_all with a select clause, Ecto expects the returned rows instead of nil. This fix adds RETURNING clause generation to these functions. Changes: - Add returning(query, sources) to update_all/1 and delete_all/1 - Add returning/2 function to extract fields from query select - Add returning_fields/3 to format RETURNING clause fields - Add returning_expr/3 to handle field expressions without table aliases Fixes: Protocol.UndefinedError when calling update_all with select Fixes: Oban job fetching which uses update_all with RETURNING
…te_all Add test/returning_clause_test.exs with 12 tests covering: - update_all with/without select clause - delete_all with/without select clause - Multiple fields in select - Multiple rows affected - Transactions with RETURNING - Complex select expressions These tests ensure the RETURNING clause fix works correctly across various scenarios and prevents regression.
Summary by CodeRabbit
Bug Fixes
New Features
Documentation
Tests
✏️ Tip: You can customize this high-level summary in your review settings.