Re: Is there a way to view a rewritten query?

From: Chris Green <chris(at)areti(dot)co(dot)uk>
To: pgsql-general(at)postgresql(dot)org
Subject: Re: Is there a way to view a rewritten query?
Date: 2004-12-03 09:03:57
Message-ID: 20041203090357.GB627@areti.co.uk
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: 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(at)areti(dot)co(dot)uk)

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

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Richard Huxton 2004-12-03 09:10:52 Re: general questions on Postgresql and deployment on win32
Previous Message Martijn van Oosterhout 2004-12-03 08:54:51 Re: reclaiming diskspace bloat w/near-zero downtime