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

From Eric Ridge
Subject Re: Weirdness using Executor Hooks
Date
Msg-id CANcm6wbq99Y0RrfcrNpJqgx1YoMD_ss1snDmjjt7gu9O174UsQ@mail.gmail.com
Whole thread Raw
In response to Re: Weirdness using Executor Hooks  (Andres Freund <andres@anarazel.de>)
Responses Re: Weirdness using Executor Hooks  (Tom Lane <tgl@sss.pgh.pa.us>)
List pgsql-hackers
On Thu, Jun 18, 2015 at 4:42 PM, Andres Freund <andres@anarazel.de> wrote:
>
>
> How does your _PG_init() actually look like?

static ExecutorStart_hook_type prev_ExecutorStartHook = NULL;
static ExecutorEnd_hook_type prev_ExecutorEndHook  = NULL;

void _PG_init(void)
{  prev_ExecutorStartHook = ExecutorStart_hook;  prev_ExecutorEndHook = ExecutorEnd_hook;
  ExecutorStart_hook = my_executor_start_hook;  ExecutorEnd_hook = my_executor_end_hook;
  RegisterXactCallback(my_xact_callback, NULL);
}

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

As a data point, that might be interesting to know, but I'd still be
scratching my head about how it happened.  Postgres doesn't load an
extension library more than once per backend session, does it?

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

I didn't.  As far as compiler flags go, the extension is just
inheriting Postgres' defaults.  Any suggestions around which flag(s)
to adjust?

I appreciate your time!

eric



pgsql-hackers by date:

Previous
From: Andres Freund
Date:
Subject: Re: Weirdness using Executor Hooks
Next
From: Alvaro Herrera
Date:
Subject: Re: Is it possible to have a "fast-write" Index?