def METHOD_NAME(
    pg_expr: pgast.Base,
    ir_expr: irast.Base,
) -> None:
    if not (
        debug.flags.edgeql_compile
        or debug.flags.edgeql_compile_sql_ast
        or debug.flags.edgeql_compile_sql_reordered_text
        or debug.flags.edgeql_compile_sql_text
    ):
        return
    if debug.flags.edgeql_compile or debug.flags.edgeql_compile_sql_ast:
        debug.header('SQL Tree')
        debug.dump(
            pg_expr, _ast_include_meta=debug.flags.edgeql_compile_sql_ast_meta
        )
    if debug.flags.edgeql_compile or debug.flags.edgeql_compile_sql_text:
        sql_text = pgcodegen.generate_source(pg_expr, pretty=True)
        debug.header('SQL')
        debug.dump_code(sql_text, lexer='sql')
    if debug.flags.edgeql_compile_sql_reordered_text:
        debug.header('Reordered SQL')
        debug_sql_text = pgcodegen.generate_source(
            pg_expr, pretty=True, reordered=True
        )
        if isinstance(ir_expr, irast.Statement):
            debug_sql_text = _rewrite_names_in_sql(
                debug_sql_text, ir_expr.schema
            )
        debug.dump_code(debug_sql_text, lexer='sql')