From: | "Dima Rybakov (Tlt)" <dim001r(at)gmail(dot)com> |
---|---|
To: | pgsql-hackers(at)lists(dot)postgresql(dot)org |
Subject: | how to read table options during smgropen() |
Date: | 2024-02-22 18:22:03 |
Message-ID: | CAH898o5ycdqctB4WLnpPojS6HFPv7QJV1Tz3ZDg4E-4SXHzatw@mail.gmail.com |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | 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
From | Date | Subject | |
---|---|---|---|
Next Message | Alvaro Herrera | 2024-02-22 18:43:00 | Re: SLRU optimization - configurable buffer pool and partitioning the SLRU lock |
Previous Message | Andrey M. Borodin | 2024-02-22 17:23:24 | Re: Transaction timeout |