Ivan Voras <ivoras@freebsd.org> writes:
> Is there any way to make _PG_init() called earlier, e.g. as soon as
> the session is established or at database connection time, something
> like that?
Preload the library --- see shared/local_preload_libraries configuration
settings.
regards, tom lane