Re: Weirdness using Executor Hooks

From: Eric Ridge <eebbrr(at)gmail(dot)com>
To: Andres Freund <andres(at)anarazel(dot)de>
Cc: "pgsql-hackers(at)postgresql(dot)org" <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: Weirdness using Executor Hooks
Date: 2015-06-18 20:54:31
Message-ID: CANcm6wbq99Y0RrfcrNpJqgx1YoMD_ss1snDmjjt7gu9O174UsQ@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On Thu, Jun 18, 2015 at 4:42 PM, Andres Freund <andres(at)anarazel(dot)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

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Alvaro Herrera 2015-06-18 21:05:03 Re: Is it possible to have a "fast-write" Index?
Previous Message Andres Freund 2015-06-18 20:42:23 Re: Weirdness using Executor Hooks