Re: Regarding extension

From: Tomas Vondra <tomas(dot)vondra(at)2ndquadrant(dot)com>
To: Natarajan R <nataraj3098(at)gmail(dot)com>
Cc: Euler Taveira <euler(at)timbira(dot)com(dot)br>, PostgreSQL Hackers <pgsql-hackers(at)lists(dot)postgresql(dot)org>
Subject: Re: Regarding extension
Date: 2019-10-03 15:24:37
Message-ID: 20191003152437.bggxs4uswmophp3f@development
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

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

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Mike Palmiotto 2019-10-03 15:39:33 Re: Hooks for session start and end, take two
Previous Message Andres Freund 2019-10-03 15:23:49 Re: fairywren failures