a question about relkind of RelationData handed over to heap_update function

From: 노홍찬 <fallsmal(at)cs(dot)yonsei(dot)ac(dot)kr>
To: <pgsql-hackers(at)postgresql(dot)org>
Subject: a question about relkind of RelationData handed over to heap_update function
Date: 2009-10-25 14:28:49
Message-ID: 000001ca557f$78179760$6846c620$@yonsei.ac.kr
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Dear hackers,

I’m modifying backend source codes of pgsql.

While inspecting the heap_update function (src/backend/access/heapam.c),

I found that the relkind fields of all RelationData which is handed over to
heap_update are all the same as ‘r’.

I want to distinguish normal relation (actual table) from primary index
relation (primary indexes of some tables).

As you know, there are 6 different relkinds (I,r,S,u,t,v,c).

I guess primary index relation’s relkind’d be the same as normal
relation’s (i.e. ‘r’).

Is there any way I can distinguish normal relation from primary index
relation in the heap_update function?

In the following code, I want to make ‘doIcl = false’ for the primary
index relation.

Thank you for reading this.

-------------- -------------- -------------- -------------- -------------- -
------------- -------------- -------------- -------------- -------------- --
------------ -------------- -------------- -------------- -------------- ---
-----------

heap_update(Relation relation, ItemPointer otid, HeapTuple newtup,

ItemPointer ctid,
TransactionId *update_xmax,

CommandId cid, Snapshot
crosscheck, bool wait)

{

HTSU_Result result;

TransactionId xid = GetCurrentTransactionId();

Bitmapset *hot_attrs;

ItemId lp;

HeapTupleData oldtup;

HeapTuple heaptup;

Page page;

Buffer buffer, newbuf;

bool need_toast, already_marked;

Size newtupsize, pagefree;

bool have_tuple_lock = false;

bool iscombo;

bool use_hot_update = false;

bool all_visible_cleared = false;

bool all_visible_cleared_new = false;

/* hongs added; variables */

#ifdef USE_ICL

bool doIcl = false, newDoIcl = false;

BufferDesc *bufHdr = NULL;

BufferDesc *newBufHdr = NULL; //for inserting
icl log of PageSetLSN

Page newpage; //for inserting icl log of PageSetLSN

ItemId newlp;

if(relation->rd_rel->relkind != 'r') {

doIcl = true;

}

else

doIcl = false;

#endif

-------------- -------------- -------------- -------------- -------------- -
------------- -------------- -------------- -------------- -------------- --
------------ -------------- -------------- -------------- -------------- ---
-----------

- Best Regards
Hongchan
( <mailto:fallsmal(at)cs(dot)yonsei(dot)ac(dot)kr> fallsmal(at)cs(dot)yonsei(dot)ac(dot)kr, (02)2123-
7757) -

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Tom Lane 2009-10-25 15:07:10 Re: a question about relkind of RelationData handed over to heap_update function
Previous Message Guillaume Smet 2009-10-25 10:29:34 Re: Parsing config files in a directory