From: | Cedric Berger <cedric(at)precidata(dot)com> |
---|---|
To: | Michael Paquier <michael(dot)paquier(at)gmail(dot)com> |
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 11:54:44 |
Message-ID: | 542E8E84.5090008@precidata.com |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-general |
On 03/10/14 10:23, Michael Paquier wrote:
> On Fri, Oct 3, 2014 at 4:57 PM, Albe Laurenz <laurenz(dot)albe(at)wien(dot)gv(dot)at
> <mailto:laurenz(dot)albe(at)wien(dot)gv(dot)at>> wrote:
> > 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"
> When looking for a global variable, a command like that is generally useful:
> $ git grep MyDatabaseId -- *.h
> src/include/access/xact.h: Oid dbId;
> /* MyDatabaseId */
> src/include/miscadmin.h:extern PGDLLIMPORT Oid MyDatabaseId;
Thanks a lot!
I didn't think 'MyDatabaseId' was a real variable name...
Cedric
From | Date | Subject | |
---|---|---|---|
Next Message | Merlin Moncure | 2014-10-03 14:44:26 | Re: How to find greatest record before known values fast |
Previous Message | Andrej Vanek | 2014-10-03 09:36:52 | Re: deadlock of lock-waits (on transaction and on tuple) using same update statement |