Re: Clarification on when _PG_init() is invoked for extensions
| От | Ayush Vatsa |
|---|---|
| Тема | Re: Clarification on when _PG_init() is invoked for extensions |
| Дата | |
| Msg-id | CACX+KaMdJ7Avd945971cZQyD5dQF7ypJqrKL9dLSy45bNfkaYg@mail.gmail.com обсуждение исходный текст |
| Ответ на | Re: Clarification on when _PG_init() is invoked for extensions (Rahila Syed <rahilasyed90@gmail.com>) |
| Ответы |
Re: Clarification on when _PG_init() is invoked for extensions
Re: Clarification on when _PG_init() is invoked for extensions Re: Clarification on when _PG_init() is invoked for extensions |
| Список | pgsql-hackers |
Hi,
CREATE extension does not automatically load or ensure that _PG_init() is run.
It mainly runs the .sql script in your extension.
Thanks for the clarification. However, in my testing,
C functions using
In a new session,
_PG_init() did run when I executed CREATE EXTENSION. I suspect this might be happening because the SQL script defines C functions using
MODULE_PATHNAME, which triggers the library load. In a new session,
_PG_init() seems to run again when any of those C functions are executed.My use case:
My use case is that I’m building an experimental extension that will be installed only in a few
databases. I want the hooks initialized by this extension to apply only to those specific
databases, while all other databases should continue with the default PostgreSQL behavior.
databases. I want the hooks initialized by this extension to apply only to those specific
databases, while all other databases should continue with the default PostgreSQL behavior.
Thank you,
Ayush
Ayush
В списке pgsql-hackers по дате отправления: