Re: Extension to rewrite queries before execution

From: Adrian Klaver <adrian(dot)klaver(at)aklaver(dot)com>
To: Jeff Janes <jeff(dot)janes(at)gmail(dot)com>, "pgsql-general(at)postgresql(dot)org" <pgsql-general(at)postgresql(dot)org>
Subject: Re: Extension to rewrite queries before execution
Date: 2015-08-13 21:02:15
Message-ID: 55CD05D7.6010503@aklaver.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

On 08/13/2015 12:49 PM, Jeff Janes wrote:
> I am looking for an extension or a technique that will allow me to
> intercept a query by the exact query text, and replace that query with a
> different one.

What is sending the query?

In other words what library is the app using to communicate with the
Postgres server?

>
> The context is running a third-party app which issues queries I have no
> control over. I'd like to intercept a specific query (which has no bind
> parameters) and either replace the query text with a different text
> which, for example, swaps out an "in list" clause to instead be an
> "exists (subquery)".
>
> Or just wrap the query in a "set enable_* =off;" or "set work_mem=*;"
> before and a reset of it after.
>
> Is there anything out there like this? This would be for 9.4.
>
> I'm willing to put the query text, and its replacement, directly into
> the extension source code and compile it, but of course something more
> flexible would be ideal.
>
> Thanks,
>
> Jeff

--
Adrian Klaver
adrian(dot)klaver(at)aklaver(dot)com

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Martín Marqués 2015-08-13 21:09:55 Re: [BDR] vs pgpool-II v3
Previous Message Melvin Davidson 2015-08-13 20:37:46 Re: Extension to rewrite queries before execution