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
refactor: Simplify main README.md transform documentation
- Remove detailed transform documentation from main README
- Keep only the packages table entry for @pgsql/transform
- Detailed documentation remains in packages/transform/README.md
- Main README now has concise highlight as requested
Co-Authored-By: Dan Lynch <[email protected]>
The `@pgsql/transform` package enables transformation of PostgreSQL ASTs between different PostgreSQL versions, providing a crucial component for building a single source of truth deparser that works with legacy SQL code.
224
-
225
-
### Core Use Case
226
-
227
-
The transform package serves as the backbone for maintaining backward compatibility in the deparser pipeline. It allows you to:
228
-
229
-
-**Transform legacy ASTs**: Convert ASTs from older PostgreSQL versions (13, 14, 15, 16) to the latest version (17)
230
-
-**Build unified deparsers**: Create a single deparser that can handle SQL from multiple PostgreSQL versions
231
-
-**Maintain compatibility**: Support legacy codebases while leveraging the latest PostgreSQL parser features
232
-
233
-
### Key Limitation
234
-
235
-
The transform package only supports ASTs that derive from SQL parseable by PostgreSQL 17. This means:
236
-
237
-
- ✅ **Supported**: SQL code from PG13-16 that is still valid in PG17
238
-
- ❌ **Not supported**: Deprecated PG13 syntax that was removed in later versions
239
-
- ❌ **Not supported**: SQL that cannot be parsed by the PG17 parser
240
-
241
-
This limitation is by design - it ensures that all transformed ASTs can be reliably deparsed using the latest PostgreSQL grammar.
The transform package is designed to work seamlessly with the broader pgsql-parser ecosystem:
334
-
335
-
1.**Parse** legacy SQL using version-specific parsers
336
-
2.**Transform** the resulting AST to the latest version
337
-
3.**Deparse** using the unified, latest-version deparser
338
-
339
-
This architecture enables a single source of truth for SQL generation while maintaining support for legacy codebases.
340
-
341
221
## Related
342
222
343
223
*[pgsql-parser](https://www.npmjs.com/package/pgsql-parser): The real PostgreSQL parser for Node.js, providing symmetric parsing and deparsing of SQL statements with actual PostgreSQL parser integration.
0 commit comments