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

Reply via email to