feat: improve PG13->PG14 AST conversion with context-aware transformations#171
Closed
pyramation wants to merge 5 commits intoexper/transfrom
Closed
feat: improve PG13->PG14 AST conversion with context-aware transformations#171pyramation wants to merge 5 commits intoexper/transfrom
pyramation wants to merge 5 commits intoexper/transfrom
Conversation
…and enum handling Co-Authored-By: Dan Lynch <pyramation@gmail.com>
…unction handling - Add comprehensive enums documentation to RULES.md - Fix createFunctionParameterFromTypeName method signature to support index parameter - Improve TableLikeOption enum mapping with specific value handling - Maintain 234/258 test pass rate while preparing for further improvements Co-Authored-By: Dan Lynch <pyramation@gmail.com>
…ction handling - Fix TableLikeOption enum mapping with specific value handling for combinations - Improve function parameter mode logic for aggregate contexts - Add context-aware substring function format handling - Maintain 234/258 test pass rate while addressing specific failure patterns Co-Authored-By: Dan Lynch <pyramation@gmail.com>
…mapping - Convert FUNC_PARAM_VARIADIC to FUNC_PARAM_DEFAULT in aggregate contexts - Handle negative values in TableLikeOption mapping - Maintain 234/258 test pass rate while debugging transformation issues Co-Authored-By: Dan Lynch <pyramation@gmail.com>
…eter handling and enum documentation - Add CreateFunctionStmt context detection for proper parameter transformation - Preserve FUNC_PARAM_VARIADIC in appropriate contexts - Improve TableLikeOption mapping with better negative value handling - Add comprehensive enums package documentation to RULES.md - Maintain 234/258 test pass rate while addressing core transformation issues Co-Authored-By: Dan Lynch <pyramation@gmail.com>
Contributor
🤖 Devin AI EngineerI'll be helping with this pull request! Here's what you should know: ✅ I will automatically:
Note: I can only respond to comments from users who have write access to this repository. ⚙️ Control Options:
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
feat: improve PG13->PG14 AST conversion with context-aware transformations
Summary
This PR improves the PostgreSQL 13 to 14 AST conversion in the transform package by implementing context-aware transformation logic and better enum handling. The changes maintain the current test pass rate of 234/258 tests (90.7%) while addressing several categories of transformation issues.
Key improvements:
CREATE_TABLE_LIKE_COMPRESSIONContext: The transformer handles complex version-specific differences between PostgreSQL 13 and 14 ASTs, requiring nuanced understanding of when to preserve vs transform enum values based on the surrounding AST context.
Review & Testing Checklist for Human
Recommended test plan: Run the transformer on a diverse set of PostgreSQL 13 DDL statements (CREATE FUNCTION, CREATE AGGREGATE, ALTER statements) and verify the resulting AST can be successfully parsed by PostgreSQL 14.
Diagram
graph TD subgraph "Transform Package" A[RULES.md]:::major-edit B[v13-to-v14.ts]:::major-edit C[13/enums.ts]:::context D[14/enums.ts]:::context end subgraph "Test Suite" E[kitchen-sink/13-14 tests]:::context F[234/258 passing]:::context end subgraph "Key Methods Modified" G[FunctionParameter]:::major-edit H[TableLikeClause]:::major-edit I[FuncCall]:::major-edit J[ObjectWithArgs]:::major-edit end B --> G B --> H B --> I B --> J C --> B D --> B E --> B subgraph Legend L1[Major Edit]:::major-edit L2[Minor Edit]:::minor-edit L3[Context/No Edit]:::context end classDef major-edit fill:#90EE90 classDef minor-edit fill:#87CEEB classDef context fill:#FFFFFFNotes
Link to Devin run: https://app.devin.ai/sessions/38143a4f464f44999273813aecad7368
Requested by: Dan Lynch (@pyramation)