You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: packages/transform/RULES.md
+33Lines changed: 33 additions & 0 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -173,6 +173,39 @@ const result = await parser.parse(sql, { version: '13' }); // With await
173
173
- Visitor pattern appears broken but works with mock data
174
174
- Tests fail because transformations aren't applied
175
175
176
+
## Using Enums Package for Op Codes and Enum Handling
177
+
178
+
When working with PG13->PG14 transformations, the enums packages in `src/13/` and `src/14/` directories are essential for handling op codes and enum value differences:
// Use enum-to-int.ts and enum-to-str.ts utilities for conversion if needed
199
+
```
200
+
201
+
### Common Enum-Related Test Failures
202
+
203
+
-**TableLikeOption values**: PG13 value 6 maps to PG14 value 12 due to compression option insertion
204
+
-**Function parameter modes**: `FUNC_PARAM_VARIADIC` vs `FUNC_PARAM_DEFAULT` differences
205
+
-**Function formats**: `COERCE_EXPLICIT_CALL` vs `COERCE_SQL_SYNTAX` handling
206
+
207
+
Always consult the enum files when debugging transformation issues involving numeric or string values that appear to be op codes or enum constants.
208
+
176
209
## Summary
177
210
178
211
Always use `@pgsql/parser` for multi-version PostgreSQL AST parsing in the transform package. This is the only way to get accurate version-specific results and build working transformers. Remember that all parser methods are async and must be awaited.
0 commit comments