On Thu, Oct 03, 2019 at 07:51:04PM +0530, Natarajan R wrote:
>Thanks for your response Euler.
>
>1)
>"id" i meant by database id
>
>I make my question simple, " during pg_init i want to get databaseid's in
>which my extension is installed... "
>1. by using pg_database and pg_extension catalogs
>2. if there any other way, kindly suggest me.
>
Well, there's also MyDatabaseId variable, which tells you the OID of the
current database. So you can use that, from the C code. In SQL, you can
simply run "SELECT current_database()" or something like that.
>
>2)
>I have one sql file which will be loaded during create extension, in that
>file only i have code for event trigger for create extension on
>ddl_command_end event....
>My question is "When giving create extension, sql file will be loaded at
>that time only, if that is the case, this event trigger will be invoked or
>not? "
>
I'm not sure I understand the question. Are you asking if the event
trigger will be invoked to notify you about creation of the extension
containing it? I'm pretty sure that won't happen - it will be executed
only for future CREATE EXTENSION commands.
regards
--
Tomas Vondra http://www.2ndQuadrant.com
PostgreSQL Development, 24x7 Support, Remote DBA, Training & Services