Re: Feedback on writing extensible modules - Mailing list pgsql-hackers

From Dimitri Fontaine
Subject Re: Feedback on writing extensible modules
Date
Msg-id 871vou9ovg.fsf@hi-media-techno.com
Whole thread Raw
In response to Re: Feedback on writing extensible modules  (Tom Lane <tgl@sss.pgh.pa.us>)
List pgsql-hackers
Tom Lane <tgl@sss.pgh.pa.us> writes:

> Dimitri Fontaine <dfontaine@hi-media.com> writes:
>> Please find attached a little little patch which run
>> process_local_preload_libraries from within a transaction.
>
> This is inevitably going to break other people's code.  Put the
> transaction wrapper in your own stuff if you have to have it.

The module is working fine on HEAD without any patch if it cares about
starting a transaction itself into _PG_init(), even when _PG_init() is
called at function call time rather than at local_preload_libraries
time.

My reserve was that I thought the transaction arround _PG_init() was
existing in a 'normal' call, so the explicit creation of it in the
module would fail:   StartTransactionCommand();   ...   CommitTransactionCommand();

Now my only problem is related to making the module 8.3 compliant:

pre_prepare.c:19:27: error: utils/snapmgr.h: No such file or directory
pre_prepare.c: In function ‘_PG_init’:
pre_prepare.c:188: warning: implicit declaration of function ‘PushActiveSnapshot’
pre_prepare.c:207: warning: implicit declaration of function ‘PopActiveSnapshot’

I guess I can document that having pre_prepare in
local_preload_libraries with preprepare.at_init = on is only support
from 8.4 onward...

Regards,
--
dim


pgsql-hackers by date:

Previous
From: Peter Eisentraut
Date:
Subject: Re: tsvector extraction patch
Next
From: Fujii Masao
Date:
Subject: FYI: fdatasync vs sync_file_range