Re: Weirdness using Executor Hooks - Mailing list pgsql-hackers

From Andres Freund
Subject Re: Weirdness using Executor Hooks
Date
Msg-id 20150618204223.GE29350@alap3.anarazel.de
Whole thread Raw
In response to Weirdness using Executor Hooks  (Eric Ridge <eebbrr@gmail.com>)
Responses Re: Weirdness using Executor Hooks  (Eric Ridge <eebbrr@gmail.com>)
List pgsql-hackers
Hi,

On 2015-06-18 16:36:17 -0400, Eric Ridge wrote:
> I've written an extension that hooks ExecutorStart_hook and
> ExecutorEnd_hook.  The hooks are assigned in _PG_init() (and the previous
> ones saved to static vars) and reset to the previous values in _PG_fini().
> Maybe also of interest is the extension library is set in postgresql.conf
> as a local_preload_libraries.  This is with Postgres 9.3.4.

How does your _PG_init() actually look like?

I'd suggest adding an error check that prev_ExecutorStartHook is
unequals to your function when you assign it.

> What happens is that rarely (and of course never on my development
> machine), the saved "prev_ExecutorXXXHook" gets set to the current value of
> ExecutorXXX_hook, so when my hook function is called:

Did you check whether it's compiler/compiler flag dependant?

Greetings,

Andres Freund



pgsql-hackers by date:

Previous
From: Eric Ridge
Date:
Subject: Weirdness using Executor Hooks
Next
From: Eric Ridge
Date:
Subject: Re: Weirdness using Executor Hooks