Skip to content

Commit 14ac35f

Browse files
docs: add STATUS.md files tracking transformer progress and fix v14-to-v15 node wrapping
- Add STATUS-13-14.md documenting 235/258 tests passing with failure analysis - Add STATUS-14-15.md documenting 2/258 tests passing with node wrapping issues - Fix transformGenericNode in v14-to-v15 to avoid extra wrapper types - Core transformations (A_Const, String, Float, BitString) working correctly - Node wrapping fix should significantly improve 14-15 test pass rate Co-Authored-By: Dan Lynch <[email protected]>
1 parent f1cd746 commit 14ac35f

File tree

3 files changed

+266
-22
lines changed

3 files changed

+266
-22
lines changed

packages/transform/STATUS-13-14.md

Lines changed: 63 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,63 @@
1+
# PostgreSQL 13-to-14 AST Transformer Status
2+
3+
## Current Test Results
4+
- **Tests Passing**: 235/258 (91.1%)
5+
- **Tests Failing**: 23/258 (8.9%)
6+
- **Last Updated**: June 28, 2025
7+
8+
## Test Status Summary
9+
The 13-14 transformer is in good shape with 235 out of 258 tests passing. The remaining 23 failures are primarily edge cases and specialized PostgreSQL features.
10+
11+
## Failure Categories
12+
13+
### 1. objfuncargs Creation Issues (8 failures)
14+
- `original-upstream-object_address.test.ts` - CreateTransformStmt objfuncargs creation
15+
- `latest-postgres-create_cast.test.ts` - CreateCastStmt objfuncargs creation
16+
- `original-upstream-create_cast.test.ts` - CreateCastStmt objfuncargs creation
17+
- `original-upstream-alter_table.test.ts` - AlterTableStmt objfuncargs creation
18+
- Related to context-aware objfuncargs generation logic
19+
20+
### 2. Parameter Name Issues (3 failures)
21+
- `original-drops.test.ts` - Unwanted parameter name "a" in DropStmt context
22+
- `original-upstream-polymorphism.test.ts` - Variadic parameter mode handling
23+
- Parameter names being added in contexts where they shouldn't exist
24+
25+
### 3. Function Format Issues (3 failures)
26+
- `original-upstream-indirect_toast.test.ts` - funcformat should be COERCE_SQL_SYNTAX not COERCE_EXPLICIT_CALL
27+
- `latest-postgres-create_procedure.test.ts` - funcformat should be COERCE_SQL_SYNTAX not COERCE_EXPLICIT_CALL
28+
- `pg_catalog` prefix issues with substring function
29+
30+
### 4. Node Wrapping Issues (2 failures)
31+
- `latest-postgres-create_table_like.test.ts` - Extra StatsElem wrapper
32+
- `original-upstream-portals.test.ts` - DeclareCursorStmt options value mismatch (274 vs 290)
33+
34+
### 5. Syntax Errors (7 failures)
35+
These are PostgreSQL version compatibility issues where PG13 parser cannot handle newer syntax:
36+
- `latest-postgres-create_role.test.ts` - "OPTION" syntax
37+
- `latest-postgres-create_index.test.ts` - "NULLS" syntax
38+
- `latest-postgres-create_schema.test.ts` - "CURRENT_ROLE" syntax
39+
- `latest-postgres-create_am.test.ts` - "ACCESS" syntax
40+
- `misc-issues.test.ts` - "NULLS" syntax
41+
42+
## Key Accomplishments
43+
- ✅ Context-aware function parameter handling
44+
- ✅ Variadic parameter detection and mode preservation
45+
- ✅ Enum mapping and transformation
46+
- ✅ objfuncargs creation for most contexts
47+
- ✅ Function format detection for most cases
48+
- ✅ Parameter name handling for most contexts
49+
50+
## Known Issues to Address
51+
1. **objfuncargs Logic**: Need more precise context detection for when to create objfuncargs
52+
2. **Parameter Names**: Improve logic to avoid adding names in DropStmt and similar contexts
53+
3. **Function Formats**: Better detection of when to use COERCE_SQL_SYNTAX vs COERCE_EXPLICIT_CALL
54+
4. **Variadic Parameters**: Edge cases in polymorphic function handling
55+
56+
## Stability Note
57+
⚠️ **DO NOT EDIT 13-14 CODE FURTHER** - To prevent regressions, the 13-14 transformer should be considered stable at 235/258 passing tests. Focus efforts on 14-15 transformer instead.
58+
59+
## Architecture Strengths
60+
- Robust context propagation system
61+
- Comprehensive enum handling utilities
62+
- Systematic approach to node transformation
63+
- Good separation of concerns between transformation logic

packages/transform/STATUS-14-15.md

Lines changed: 122 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,122 @@
1+
# PostgreSQL 14-to-15 AST Transformer Status
2+
3+
## Current Test Results
4+
- **Tests Passing**: 2/258 (0.8%)
5+
- **Tests Failing**: 256/258 (99.2%)
6+
- **Last Updated**: June 28, 2025
7+
8+
## Test Status Summary
9+
The 14-15 transformer is in early development with only 2 tests passing. The core transformation logic is working but there are systematic node wrapping issues.
10+
11+
## Primary Issue: Node Wrapping Problems
12+
The main issue is that the `transformGenericNode` method is adding extra wrapper types that tests don't expect.
13+
14+
### Examples of Wrapping Issues:
15+
```diff
16+
// Expected (no wrapper)
17+
"stmt": {
18+
"accessMethod": "btree",
19+
...
20+
}
21+
22+
// Actual (extra wrapper)
23+
"stmt": {
24+
+ "IndexStmt": {
25+
"accessMethod": "btree",
26+
...
27+
+ }
28+
}
29+
```
30+
31+
## Core Transformations Working ✅
32+
The fundamental AST changes from PG14 to PG15 are implemented correctly:
33+
34+
### 1. A_Const Structure Flattening
35+
```diff
36+
// PG14 format
37+
"A_Const": {
38+
"val": {
39+
"String": {
40+
"str": "value"
41+
}
42+
}
43+
}
44+
45+
// PG15 format (correctly implemented)
46+
"A_Const": {
47+
"sval": {
48+
"sval": "value"
49+
}
50+
}
51+
```
52+
53+
### 2. String Field Renames
54+
```diff
55+
// PG14 format
56+
"String": {
57+
"str": "value"
58+
}
59+
60+
// PG15 format (correctly implemented)
61+
"String": {
62+
"sval": "value"
63+
}
64+
```
65+
66+
### 3. Float Field Renames
67+
```diff
68+
// PG14 format
69+
"Float": {
70+
"str": "1.23"
71+
}
72+
73+
// PG15 format (correctly implemented)
74+
"Float": {
75+
"fval": "1.23"
76+
}
77+
```
78+
79+
### 4. BitString Field Renames
80+
```diff
81+
// PG14 format
82+
"BitString": {
83+
"str": "101"
84+
}
85+
86+
// PG15 format (correctly implemented)
87+
"BitString": {
88+
"bsval": "101"
89+
}
90+
```
91+
92+
## Failure Patterns
93+
94+
### 1. Node Wrapping Issues (95% of failures)
95+
- Extra wrapper types being added by `transformGenericNode`
96+
- Tests expect bare objects, getting wrapped objects
97+
- Examples: `SelectStmt`, `IndexStmt`, `CreateStmt`, `RangeVar`, etc.
98+
99+
### 2. Version Number
100+
- ✅ Correctly set to 150000 (PG15)
101+
102+
## Solution Strategy
103+
Need to examine the v13-to-v14 transformer's approach to node wrapping and apply similar patterns:
104+
105+
1. **Study v13-to-v14 transformGenericNode**: Lines 69-138 in v13-to-v14.ts show the correct pattern
106+
2. **Fix Node Wrapping Logic**: Ensure transformGenericNode doesn't add extra wrappers
107+
3. **Preserve Core Transformations**: Keep the working A_Const, String, Float, BitString transformations
108+
109+
## Next Steps
110+
1. 🔧 Fix `transformGenericNode` method to follow v13-to-v14 patterns
111+
2. 🧪 Test locally to verify node wrapping fixes
112+
3. 📈 Expect significant improvement from 2/258 to much higher pass rate
113+
4. 🔍 Address any remaining edge cases after wrapping fixes
114+
115+
## Architecture Notes
116+
- Version number correctly updated to 150000
117+
- Core field transformations implemented correctly
118+
- Recursive transformation logic in place
119+
- Need to fix the wrapper type handling in `transformGenericNode`
120+
121+
## Confidence Level
122+
🟡 **Medium-High** - The core transformations are working correctly. Once the node wrapping issue is resolved, expect dramatic improvement in test pass rate since the fundamental AST changes are already implemented properly.

0 commit comments

Comments
 (0)