Re: How do I get the name of the relation on which FDW has been called?

From: Atri Sharma <atri(dot)jiit(at)gmail(dot)com>
To: Shigeru HANADA <shigeru(dot)hanada(at)gmail(dot)com>
Cc: Pg Hackers <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: How do I get the name of the relation on which FDW has been called?
Date: 2012-05-30 12:09:12
Message-ID: CAOeZVidU17YFqLMiDcbuE5DjgGALd3vfA7+KZXVXFgB+FXGB7A@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On Wed, May 30, 2012 at 5:15 PM, Shigeru HANADA
<shigeru(dot)hanada(at)gmail(dot)com> wrote:
> Hi Atri,
>
> (2012/05/30 19:49), Atri Sharma wrote:
>> SELECT * FROM table1;
>>
>> If,for above command,fdw1 is invoked,how do I get the name/Oid of the
>> table(i.e. table1) in fdw1?
>
> For 9.1 and 9.0, you can get foreign table's oid as the first parameter
> of PlanForeignScan function.  For 9.2, you can get it as the third
> parameter of GetForeignRelSize, GetForeignPaths, and GetForeignPlan
> functions.  In other functions, calling
> RelationGetRelid(ForeignScanState->ss.ss_currentRelation) returns the
> oid of the foreign table.
>
> Once you obtained oid of a foreign table, you can get the name of the
> foreign table by calling get_rel_name function with the oid, as same as
> ordinary tables.
>
> Regards,
> --
> Shigeru HANADA

Thanks a ton Shigeru!!!

It is really helpful...

--
Regards,

Atri
l'apprenant

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Robert Haas 2012-05-30 12:24:55 Re: Uh, I change my mind about commit_delay + commit_siblings (sort of)
Previous Message Shigeru HANADA 2012-05-30 11:45:27 Re: How do I get the name of the relation on which FDW has been called?