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

From Chris Green
Subject Re: Is there a way to view a rewritten query?
Date
Msg-id 20041203090357.GB627@areti.co.uk
Whole thread Raw
In response to Is there a way to view a rewritten query?  (Jonathan Knopp <pgsql@delegated.net>)
List pgsql-general
On Thu, Dec 02, 2004 at 09:32:35PM -0800, Jonathan Knopp wrote:
> 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.
> someone please tell me there's a simple way of doing this cause i'm
> ready to take a hammer to my computer.
>
One rather clumsy way to do it is to have a script which drops the
whole query and rule set and then recreates it.  I do this when
creating views.

I have a separate window open with my editor showing the script in
question, nicely formatted.  In the psql window I can then just \i the
script and see the diagnostics, then go back to the edit window and
edit the original and try again.

--
Chris Green (chris@areti.co.uk)

    "Never ascribe to malice, that which can be explained by incompetence."

pgsql-general by date:

Previous
From: Martijn van Oosterhout
Date:
Subject: Re: reclaiming diskspace bloat w/near-zero downtime
Next
From: Richard Huxton
Date:
Subject: Re: general questions on Postgresql and deployment on win32