-
Notifications
You must be signed in to change notification settings - Fork 100
fix: sql fn params #366
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
base: main
Are you sure you want to change the base?
fix: sql fn params #366
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull Request Overview
This PR fixes SQL function parameter substitution by replacing function parameters with type‐based default values while refactoring SQL function signature extraction and integrating these changes into the typecheck flow.
- Added utility methods to StatementId.
- Refactored SQL function parsing to utilize SQLFunctionSignature and SQLFunctionArgs.
- Updated document parsing, typecheck, and identifier application with improved default value resolution.
Reviewed Changes
Copilot reviewed 17 out of 17 changed files in this pull request and generated 3 comments.
Show a summary per file
File | Description |
---|---|
crates/pgt_workspace/src/workspace/server/statement_identifier.rs | Added helper methods (is_root, is_child, parent) for statement hierarchy. |
crates/pgt_workspace/src/workspace/server/sql_function.rs | Introduced SQLFunctionSignature and revamped function parameter extraction. |
crates/pgt_workspace/src/workspace/server/parsed_document.rs | Removed legacy SQLFunctionBodyStore and integrated new SQL function extraction. |
crates/pgt_workspace/src/workspace/server/document.rs | Added statement_content method to get statement SQL content. |
crates/pgt_workspace/src/workspace/server.rs | Updated typecheck integration with new schema cache and identifier handling. |
crates/pgt_typecheck/src/typed_identifier.rs | Enhanced apply_identifiers with default value formatting and support for type-based defaults. |
crates/pgt_treesitter_queries | Updated parameter extraction queries and tests for ParameterMatch. |
Other files | Minor adjustments to tests, diagnostics, and schema cache types to support the changes. |
Comments suppressed due to low confidence (1)
crates/pgt_workspace/src/workspace/server.rs:376
- [nitpick] The async block here could be refactored for improved readability and maintainability. A clearer structure may help future developers understand the schema cache and identifier propagation logic.
// sorry for the ugly code :(
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
the idea is to replace the fn params with a default value based on their type:
will become
Todo
apply_identifiers
fixes #353
fixes #352