Re: Getting my Database name in a C Extension

From: Albe Laurenz <laurenz(dot)albe(at)wien(dot)gv(dot)at>
To: "Cedric Berger *EXTERN*" <cedric(at)precidata(dot)com>, Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Cc: "pgsql-general(at)postgresql(dot)org" <pgsql-general(at)postgresql(dot)org>
Subject: Re: Getting my Database name in a C Extension
Date: 2014-10-03 07:57:08
Message-ID: A737B7A37273E048B164557ADEF4A58B17D55514@ntex2010i.host.magwien.gv.at
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

Cedric Berger wrote:
>>> 1) What is the easiest way to get that directly in C?
>>
>> The usual locution is "get_database_name(MyDatabaseId)".
>
> Ok, but then how do I find "MyDatabaseId" in, say,
> a BeginForeignScan() or GetForeignRelSize() FDW callback?

It is a global, all you should have to do is
#include "miscadmin.h"

Yours,
Laurenz Albe

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Michael Paquier 2014-10-03 08:23:37 Re: Getting my Database name in a C Extension
Previous Message Achilleas Mantzios 2014-10-03 07:49:45 Re: PostgreSQL Inheritance and column mapping