Parameter · Reporting and Logging / What to Log
debug_print_rewritten
Logs each query's rewritten parse tree.
- Default:
off - Type: bool
- Applies: Session (any user)
In plain words
Like debug_print_parse, but shows the query after PostgreSQL has replaced views with their definitions and applied rules. Useful to see what a query over views really becomes, for developers.
For DBAs and operators
Printed as LOG: rewritten parse tree: with a DETAIL containing a list of Query nodes (a rule can turn one statement into several, hence the parentheses):
Compare with debug_print_parse to see view expansion (the view's range table entry becomes a subquery), row-level security quals added, and INSTEAD rules. Per session only; set client_min_messages = log to see it in psql. Formatting follows debug_pretty_print.
How to change it
Any user can change it for their session with SET.