Re: How to get the name of the current database in C function/extention inside a trigger?

From: alex m <al-gen(at)serendipia(dot)email>
To: David Rowley <dgrowleyml(at)gmail(dot)com>
Cc: PostgreSQL General <pgsql-general(at)lists(dot)postgresql(dot)org>
Subject: Re: How to get the name of the current database in C function/extention inside a trigger?
Date: 2020-08-03 15:14:35
Message-ID: cf03f9e5-61aa-53fd-6ecd-d3e54d2560fb@serendipia.email
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

Thanks.

El 03/08/2020 a las 16:04, David Rowley escribió:

> On Mon, 3 Aug 2020 at 21:26, alex m <al-gen(at)serendipia(dot)email> wrote:
>> I'm writting a function/extention in C for a trigger. Inside a trigger, in C, I want to get the name of the current database. However, not via SPI_exec(), SPI_prepare() and the like, but more directly, in a more faster way.
> You can use MyDatabaseId in miscadmin.h
>
> If you git grep MyDatabaseId in src/contrib you can see some examples.
>
> A good tip for the future would be to just look at the source code of
> the built-in function and see how it does it.
>
> David

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Stelios Sfakianakis 2020-08-03 16:23:50 Keeping state in a foreign data wrapper
Previous Message Ben Chobot 2020-08-03 14:41:44 Re: 12.3 replicas falling over during WAL redo