how to read table options during smgropen() - Mailing list pgsql-hackers

From Dima Rybakov (Tlt)
Subject how to read table options during smgropen()
Date
Msg-id CAH898o5ycdqctB4WLnpPojS6HFPv7QJV1Tz3ZDg4E-4SXHzatw@mail.gmail.com
Whole thread Raw
Responses Re: how to read table options during smgropen()
List 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 by date:

Previous
From: "Andrey M. Borodin"
Date:
Subject: Re: Transaction timeout
Next
From: Alvaro Herrera
Date:
Subject: Re: SLRU optimization - configurable buffer pool and partitioning the SLRU lock