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

Поиск
Список
Период
Сортировка
От Shigeru HANADA
Тема Re: How do I get the name of the relation on which FDW has been called?
Дата
Msg-id 4FC60857.4040808@gmail.com
обсуждение исходный текст
Ответ на How do I get the name of the relation on which FDW has been called?  (Atri Sharma <atri.jiit@gmail.com>)
Ответы Re: How do I get the name of the relation on which FDW has been called?  (Atri Sharma <atri.jiit@gmail.com>)
Список pgsql-hackers
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


В списке pgsql-hackers по дате отправления:

Предыдущее
От: Heikki Linnakangas
Дата:
Сообщение: Re: slow dropping of tables, DropRelFileNodeBuffers, tas
Следующее
От: Atri Sharma
Дата:
Сообщение: Re: How do I get the name of the relation on which FDW has been called?