Re: Is there a way to view a rewritten query? - Mailing list pgsql-general

From Tom Lane
Subject Re: Is there a way to view a rewritten query?
Date
Msg-id 22245.1102092164@sss.pgh.pa.us
Whole thread Raw
In response to Is there a way to view a rewritten query?  (Jonathan Knopp <pgsql@delegated.net>)
List pgsql-general
Jonathan Knopp <pgsql@delegated.net> writes:
> I'm trying to set up some complex rules and having a hard time figuring
> out why they won't work. Being able to see the query after all the rules
> have been applied would be a huge help, but I can't seem to find a way
> to do this. log_statement only shows the original. debug_print_rewritten
> works, but displays it in such a way as to be virtually unusable.

Sorry, but that's all there is.  The rewriter isn't a source-to-source
transformation.

(If you feel like hacking, it might be interesting to try applying
the ruleutils.c functions to the rewritten querytree, but I'm quite
unsure how readable the result will be.)

            regards, tom lane

pgsql-general by date:

Previous
From: "Ed L."
Date:
Subject: Re: reclaiming diskspace bloat w/near-zero downtime
Next
From: Bruno Wolff III
Date:
Subject: Re: Indexes?