how to read table options during smgropen()

Поиск
Список
Период
Сортировка
От Dima Rybakov (Tlt)
Тема how to read table options during smgropen()
Дата
Msg-id CAH898o5ycdqctB4WLnpPojS6HFPv7QJV1Tz3ZDg4E-4SXHzatw@mail.gmail.com
обсуждение исходный текст
Ответы Re: how to read table options during smgropen()
Список pgsql-hackers
Dear pgsql hackers,

I am developing custom storage for pgsql tables. I am using md* functions and smgrsw[] structure to switch between different magnetic disk access methods. 

I want to add some custom options while table created 
psql# create table t(...) with (my_option='value');

And thus I want to set "reln->smgr_which" conditionally during smgropen(). If myoption='value' i would use another smgr_which 

I am really stuck at this point.

smgr.c:
SMgrRelation
smgropen(RelFileNode rnode, BackendId backend){
...
  if ( HasOption(rnode, "my_option","value")){ //<< how to implement this check ?
    reln->smgr_which = 1; //new access method
  }else{
    reln->smgr_which = 0; //old access method
  }
...
}


The question is --- can I read table options while the table is identified by  "RelFileNode rnode" ??

The only available information is 
typedef struct RelFileNode
{
  Oid spcNode; /* tablespace */
  Oid dbNode; /* database */
  Oid relNode; /* relation */
} RelFileNode;

But there are no table options available directly from this structure.
What is the best way to implement HasOption(rnode, "my_option","value")

Thank you in advance for any ideas.
Sincerely,
Dmitry R

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

Предыдущее
От: "Andrey M. Borodin"
Дата:
Сообщение: Re: Transaction timeout
Следующее
От: Alvaro Herrera
Дата:
Сообщение: Re: SLRU optimization - configurable buffer pool and partitioning the SLRU lock