On Wed, Oct 02, 2019 at 09:09:53PM -0700, Andres Freund wrote:
> On 2019-10-03 11:03:39 +0900, Michael Paquier wrote:
>> The idea here is to have a hook which can be triggered at the start of
>> a process which can be externally triggered, which I guess is normal
>> even for WAL senders not connected to a database.
>
> But what can you do in that situation? Without a database connection,
> for example, you better not consider inserting anything into a table.
Adding extra custom logging information, or plug that information
elsewhere than Postgres. I have use cases for that when it comes to
store external telemetry data or audit things for events happening
specifically in Postgres.
> I have *SERIOUS* problems with performing additional writing
> transactions in case of a FATAL. Something might have thrown that for a
> reason, and just carrying on executing an arbitrary amount of code, this
> might even involve triggers etc, imo seriously is not OK.
Well, hook authors can do a lot of stupid things.. Anyway it looks
that the end hook is out of scope as far as the discussion has gone
based on the lack of facility, and that there is still interest for
the start hook.
I am just attaching a separate patch which adds only the start hook.
The discussion could always respawn from that. This takes care of the
HBA configuration when testing on Windows, and the module is still
named "hooks" intentionally to avoid a future rename.
--
Michael