|
1 | 1 | # PostgreSQL v15-to-v16 AST Transformer Status |
2 | 2 |
|
3 | | -## Current Status: **IN PROGRESS** 🟡 |
4 | | -- **Test Pass Rate**: 194/258 tests passing (75.2% success rate) - **STABLE BASELINE** |
| 3 | +## Current Status: **STABLE BASELINE ACHIEVED** 🟢 |
| 4 | +- **Test Pass Rate**: 194/258 tests passing (75.2% success rate) |
5 | 5 | - **Branch**: `transform/pg15-pg16` |
6 | 6 | - **PR**: [#182](https://github.com/launchql/pgsql-parser/pull/182) |
7 | 7 |
|
8 | | -## Progress Summary |
9 | | -Started from a basic skeleton transformer and systematically implemented node wrapping and transformation logic across all node types. Made significant progress improving test pass rate from initial ~30% to current 75.2%. |
10 | | - |
11 | 8 | ## Key Achievements |
| 9 | +- ✅ Improved from 184 to 194 passing tests (+10 test improvement) |
12 | 10 | - ✅ Implemented comprehensive node transformation methods for 100+ node types |
13 | 11 | - ✅ Fixed node wrapping issues across SelectStmt, InsertStmt, UpdateStmt, DeleteStmt |
14 | 12 | - ✅ Resolved PartitionSpec strategy mapping in CreateStmt method |
15 | 13 | - ✅ Added proper Array handling to transform method for nested node processing |
16 | | -- ✅ Implemented context-aware Integer transformation logic for DefineStmt contexts |
| 14 | +- ✅ Implemented context-aware Integer transformation logic for TypeName and DefineStmt contexts |
17 | 15 | - ✅ Added GrantRoleStmt admin_opt to opt field transformation |
| 16 | +- ✅ Maintained stable baseline through multiple iterations without regressions |
18 | 17 |
|
19 | 18 | ## Current Challenge: Remaining 64 Failing Tests |
20 | | -**Root Issue**: Successfully established stable baseline of 194 passing tests with conservative Integer transformation logic. Multiple attempts to add FuncCall context transformation caused regressions, indicating need for more targeted approach. |
| 19 | +**Root Issue**: Need to identify conservative, surgical transformation opportunities that can improve test pass rate without causing regressions from the stable 194 baseline. |
| 20 | + |
| 21 | +**Key Constraints**: |
| 22 | +- Must work only with AST structure (no location or SQL string dependencies) |
| 23 | +- Cannot cause regressions from 194 passing tests baseline |
| 24 | +- Must implement extremely targeted fixes for specific contexts only |
| 25 | +- Focus on local test improvements only (ignore CI failures) |
| 26 | + |
| 27 | +## Strategic Plan for Improving Beyond 194 Passing Tests |
21 | 28 |
|
22 | | -**Analysis Completed**: |
23 | | -- ✅ Fixed over-transformation: A_Const ival transformation now conservative, only transforms in specific contexts |
24 | | -- ✅ Fixed under-transformation: Added TypeName arrayBounds and DefineStmt args contexts to Integer method |
25 | | -- ✅ Empty Integer objects in TypeName arrayBounds context now transform to `{"ival": -1}` |
26 | | -- ✅ Empty Integer objects in DefineStmt args context now transform to `{"ival": -1}` |
27 | | -- ✅ Reverted INSERT and FuncCall transformation logic to prevent regressions |
28 | | -- ✅ Maintained stable baseline of 194 passing tests through multiple iterations |
29 | | -- 🔄 Need systematic analysis of remaining 64 failing tests without causing regressions |
| 29 | +### Approach: Conservative, Surgical Transformations |
| 30 | +The goal is to incrementally improve the remaining 64 failing tests while maintaining the stable 194 baseline. Each improvement should target 5-10 additional passing tests per iteration. |
30 | 31 |
|
31 | | -## Failing Tests (64 total) |
| 32 | +### Phase 1: Analyze Specific Failing Test Patterns |
| 33 | +1. **Individual Test Analysis**: Create targeted debug scripts for top failing tests: |
| 34 | + - `original/upstream/strings-165.sql` - FuncCall context transformations |
| 35 | + - `original/upstream/rangetypes-285.sql` - TypeName arrayBounds enhancements |
| 36 | + - `original/upstream/numeric-549.sql` - Numeric context transformations |
| 37 | + - `original/upstream/alter_table-234.sql` - INSERT VALUES contexts |
32 | 38 |
|
33 | | -### Latest PostgreSQL Tests (9 tests) |
34 | | -- [ ] latest/postgres/create_aggregate-6.sql |
35 | | -- [ ] latest/postgres/create_am-62.sql |
36 | | -- [ ] latest/postgres/create_function_sql-6.sql |
37 | | -- [ ] latest/postgres/create_index-55.sql |
38 | | -- [ ] latest/postgres/create_operator-14.sql |
39 | | -- [ ] latest/postgres/create_procedure-62.sql |
40 | | -- [ ] latest/postgres/create_role-80.sql |
41 | | -- [ ] latest/postgres/create_type-55.sql |
42 | | -- [ ] latest/postgres/create_view-274.sql |
| 39 | +2. **Pattern Identification**: Look for common AST structures in failing tests that can be safely transformed without affecting passing tests |
43 | 40 |
|
44 | | -### Miscellaneous Tests (3 tests) |
45 | | -- [ ] misc/inflection-20.sql |
46 | | -- [ ] misc/issues-13.sql |
47 | | -- [ ] pretty/misc-7.sql |
| 41 | +3. **Context Detection**: Develop highly specific context detection methods that can distinguish transformation-worthy cases |
48 | 42 |
|
49 | | -### Original Tests (65 tests) |
50 | | -- [ ] original/a_expr-1.sql |
51 | | -- [ ] original/custom-5.sql |
52 | | -- [ ] original/define-1.sql |
53 | | -- [ ] original/sequences/sequences-3.sql |
54 | | -- [ ] original/statements/select-2.sql |
55 | | -- [ ] original/upstream/aggregates-205.sql |
56 | | -- [ ] original/upstream/alter_generic-36.sql |
57 | | -- [ ] original/upstream/alter_table-15.sql |
58 | | -- [ ] original/upstream/arrays-1.sql |
59 | | -- [ ] original/upstream/brin-5.sql |
60 | | -- [ ] original/upstream/case-7.sql |
61 | | -- [ ] original/upstream/create_aggregate-6.sql |
62 | | -- [ ] original/upstream/create_function_3-6.sql |
63 | | -- [ ] original/upstream/create_index-55.sql |
64 | | -- [ ] original/upstream/create_table-33.sql |
65 | | -- [ ] original/upstream/create_view-209.sql |
66 | | -- [ ] original/upstream/date-257.sql |
67 | | -- [ ] original/upstream/dbsize-1.sql |
68 | | -- [ ] original/upstream/domain-40.sql |
69 | | -- [ ] original/upstream/drop_if_exists-67.sql |
70 | | -- [ ] original/upstream/enum-91.sql |
71 | | -- [ ] original/upstream/event_trigger-98.sql |
72 | | -- [ ] original/upstream/float8-79.sql |
73 | | -- [ ] original/upstream/foreign_data-202.sql |
74 | | -- [ ] original/upstream/foreign_key-54.sql |
75 | | -- [ ] original/upstream/geometry-1.sql |
76 | | -- [ ] original/upstream/gin-1.sql |
77 | | -- [ ] original/upstream/inherit-174.sql |
78 | | -- [ ] original/upstream/insert-13.sql |
79 | | -- [ ] original/upstream/int2-37.sql |
80 | | -- [ ] original/upstream/int4-39.sql |
81 | | -- [ ] original/upstream/int8-66.sql |
82 | | -- [ ] original/upstream/interval-132.sql |
83 | | -- [ ] original/upstream/join-14.sql |
84 | | -- [ ] original/upstream/json-53.sql |
85 | | -- [ ] original/upstream/jsonb-53.sql |
86 | | -- [ ] original/upstream/misc_functions-6.sql |
87 | | -- [ ] original/upstream/money-47.sql |
88 | | -- [ ] original/upstream/name-34.sql |
89 | | -- [ ] original/upstream/numeric-549.sql |
90 | | -- [ ] original/upstream/numeric_big-535.sql |
91 | | -- [ ] original/upstream/numerology-6.sql |
92 | | -- [ ] original/upstream/object_address-18.sql |
93 | | -- [ ] original/upstream/plpgsql-333.sql |
94 | | -- [ ] original/upstream/polymorphism-2.sql |
95 | | -- [ ] original/upstream/privileges-265.sql |
96 | | -- [ ] original/upstream/psql_crosstab-1.sql |
97 | | -- [ ] original/upstream/rangetypes-285.sql |
98 | | -- [ ] original/upstream/returning-16.sql |
99 | | -- [ ] original/upstream/rolenames-2.sql |
100 | | -- [ ] original/upstream/rowsecurity-167.sql |
101 | | -- [ ] original/upstream/rowtypes-81.sql |
102 | | -- [ ] original/upstream/sanity_check-3.sql |
103 | | -- [ ] original/upstream/select-77.sql |
104 | | -- [ ] original/upstream/sequence-9.sql |
105 | | -- [ ] original/upstream/strings-165.sql |
106 | | -- [ ] original/upstream/tablesample-44.sql |
107 | | -- [ ] original/upstream/text-19.sql |
108 | | -- [ ] original/upstream/triggers-62.sql |
109 | | -- [ ] original/upstream/type_sanity-1.sql |
110 | | -- [ ] original/upstream/union-87.sql |
111 | | -- [ ] original/upstream/updatable_views-2.sql |
112 | | -- [ ] original/upstream/window-24.sql |
113 | | -- [ ] original/upstream/with-39.sql |
114 | | -- [ ] original/upstream/xmlmap-3.sql |
| 43 | +### Phase 2: Implement Targeted Fixes |
| 44 | +1. **Conservative Conditions**: Add extremely specific transformation conditions that only apply to well-defined contexts |
| 45 | +2. **Incremental Testing**: Test each fix individually to ensure no regressions from 194 baseline |
| 46 | +3. **Rollback Strategy**: Immediately revert any changes that cause test count to decrease |
115 | 47 |
|
116 | | -## Debug Tools Created |
117 | | -- `debug-transformation-source.js` - Traces DefineStmt args transformation pipeline |
118 | | -- `debug-context-propagation.js` - Analyzes context information flow through transformer |
119 | | -- `debug-integer-bypass.js` - Confirms Integer method is never called |
120 | | -- Multiple analysis scripts for specific failing test patterns |
| 48 | +### Phase 3: Systematic Improvement |
| 49 | +1. **Target Categories**: Focus on specific failing test categories one at a time |
| 50 | +2. **Verification**: Run full test suite after each change to confirm improvements |
| 51 | +3. **Documentation**: Update this status file with each successful improvement |
121 | 52 |
|
122 | | -## Next Steps |
123 | | -1. Analyze specific failing test patterns without broad transformation approaches |
124 | | -2. Identify minimal, targeted fixes that don't affect the 194 passing tests |
125 | | -3. Focus on individual failing test cases to understand precise transformation requirements |
126 | | -4. Implement extremely conservative fixes that only address specific edge cases |
127 | | -5. Maintain 194 passing tests baseline while incrementally improving failing tests |
| 53 | +## Current Test Status: 194 passing, 64 failed, 258 total |
128 | 54 |
|
129 | | -## Test Categories |
130 | | -- **Passing (194)**: Basic node transformations, most SQL constructs, Integer transformations in TypeName and DefineStmt contexts |
131 | | -- **Failing (64)**: Complex nested structures, remaining transformation edge cases, INSERT VALUES contexts |
| 55 | +## Key Constraints |
| 56 | +- **No Regressions**: Must maintain 194 passing tests baseline at all times |
| 57 | +- **AST-Only**: Work only with AST structure, no location or SQL string dependencies |
| 58 | +- **Local Focus**: Ignore CI failures, focus purely on local test improvements |
| 59 | +- **Conservative Approach**: Implement only extremely targeted, well-defined transformations |
132 | 60 |
|
133 | | -## Technical Notes |
134 | | -- Following patterns from v14-to-v15 transformer as reference |
135 | | -- Focus only on v15-to-v16 transformer per user instructions |
136 | | -- Ignoring CI failures per user directive, focusing on local test improvements |
137 | | -- Maintaining systematic approach to avoid regressions |
138 | | -- Root cause identified: context propagation issue in DefineStmt args processing |
| 61 | +## Success Metrics |
| 62 | +- Target: 210+ passing tests (16+ test improvement from current baseline) |
| 63 | +- Method: Incremental improvements of 5-10 tests per iteration |
| 64 | +- Verification: Full test suite validation after each change |
0 commit comments