Canfor (1600)
25-Minute Talk
In this talk we'll go into details about how we've extended pg_query, the Postgres parser as a library, to enable new use cases for rewriting Postgres queries.
Rewrites are made possible by two components: a Protobuf-based AST representation derived from Postgres raw parse trees, and language bindings that provide convenience functions for walking and modifying the tree.
We'll also discuss specific examples of where this is useful, for example to turn certain OR queries into UNIONs or materialize scans on a table.
You'll also learn details about the pg_query deparser that supports the complete range of Postgres query syntax (including DDL!), and has an optional format mode that can pretty print the emitted query.


