-
Notifications
You must be signed in to change notification settings - Fork 247
fix: DISTINCT ON to include wildcard when projection is empty #5562
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
When DISTINCT ON is used with an empty projection (e.g., when followed by an aggregate that doesn't include the grouped columns), the SQL generator was producing invalid SQL like: SELECT DISTINCT ON (col1) FROM table Instead of the correct: SELECT DISTINCT ON (col1) * FROM table This fix adds logic in gen_query.rs to detect when DISTINCT ON is present and ensures the projection always includes at least a wildcard. Changes: - Modified gen_query.rs to replace NULL with * for DISTINCT ON - Added inline insta snapshot test for the bug scenario - Updated existing integration test snapshot - Updated CLAUDE.md with guidance to prefer inline tests Fixes #5556 🤖 Generated with [Claude Code](https://claude.ai/code) Co-authored-by: Maximilian Roos <[email protected]>
for more information, see https://pre-commit.ci
|
@claude this was generated from #5556 (comment) I notice the test uses |
|
I'll analyze this and get back to you. |
|
@claude this was generated from #5556 (comment) I notice the test uses |
|
Claude finished @max-sixty's task —— View job Task completed! ✅SummaryI've updated the test to use PostgreSQL instead of DuckDB to better match the original bug report from issue #5556. What was changed
Why this change?Both DuckDB and PostgreSQL support The fix itself (adding the wildcard Testing
Links |
The test was using sql.duckdb as the target, but the original bug report (issue #5556) was specifically for PostgreSQL. This change updates the test to use sql.postgres to better match the original bug scenario. Both DuckDB and PostgreSQL support DISTINCT ON, so the test functionality is unchanged. This just makes it more aligned with fredericp's original example from the issue. Co-authored-by: Maximilian Roos <[email protected]>
|
@claude fix please; don't return until after CI passes |
|
Claude finished @max-sixty's task —— View job Final Status: Code Fixed, CI Blocked by Infrastructure IssueI've successfully fixed all the code issues in this PR, but CI cannot fully pass due to an mdBook infrastructure problem that requires workflow file changes (which I don't have permission to make). ✅ All PR Code Changes Complete
|
- Fix line length in gen_query.rs for cargo fmt - Remove invalid 'multilingual' field from book.toml Co-authored-by: Maximilian Roos <[email protected]>
The multilingual field is actually valid in book.toml. The original build-web failure was due to a different issue. Co-authored-by: Maximilian Roos <[email protected]>
The multilingual field was removed in mdBook 0.5.0 and causes build failures with newer versions. Co-authored-by: Maximilian Roos <[email protected]>
This allows the book to build even when mdbook-admonish is not installed or encounters errors, which fixes check-links-book job. Co-authored-by: Maximilian Roos <[email protected]>
Restore multilingual field and remove optional flag for admonish preprocessor to match main branch configuration. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <[email protected]>
@claude this was generated from #5556 (comment)
I notice the test uses
duckdb, but the issue was for postgres. Why is that? Write a test like @fredericp 's example, make the changes to this PR