Source Code Help Needed - Mailing list pgsql-hackers

From Vikram Kalsi
Subject Source Code Help Needed
Date
Msg-id ed5f0fd7050525115022954064@mail.gmail.com
Whole thread Raw
Responses Re: Source Code Help Needed
List pgsql-hackers
Hello,

I've been using Postgresql-8.0.1 (Release date: 2005-01-31) for my
research work and I guess I finally need some help with it...

I'm not trying to modify the existing functionality, but I want to add
few things. In particular, I'm calculating two new Cost values and I
need to use them while the query is executing. Please See code
snippets below-

1.) New Variables ADDED to src/include/nodes/plannodes.h
typedef struct Plan
{       Cost            hutz_tbl_benefit;       /* Benefit for TableAccess */       Cost            hutz_idx_benefit;
   /* Benefit for IndexScan */ 
}


2.)  New Variables ADDED to src/include/nodes/relation.h
typedef struct Plan
{       Cost            hutz_tbl_benefit;       /* Benefit for TableAccess */       Cost            hutz_idx_benefit;
   /* Benefit for IndexScan */ 
}


3.) ADDITIONS to costsize.c

void cost_seqscan(Path *path, Query *root,                        RelOptInfo *baserel)
{       path->hutz_tbl_benefit = xxxxx;       path->hutz_idx_benefit = xxxxx;
}


void cost_index(Path *path, Query *root, RelOptInfo *baserel,                  IndexOptInfo *index, List *indexQuals,
boolis_injoin) 
{       path->hutz_tbl_benefit = xxxxx;       path->hutz_idx_benefit = xxxxx;
}


However, after these modifications the server process crashes on
running a Join query like
"select s_suppkey,c_custkey from supplier,customer where s_suppkey>125
and s_suppkey<128 and c_custkey>100 and c_custkey<103 and
c_custkey=s_suppkey"

But, this query runs fine "select s_suppkey from supplier where
s_suppkey>125 and s_suppkey<128"

I'm tracing the point at which the process crashes and at this point
it seems to inside
src/backend/optimizer/path/joinrels.c>>make_rels_by_joins()

So, my question is, after adding the two new variables what other
modifications do I need to make for code to work, And later on, what
changes are reqd so that I can access these variables while executing
the Query Plan in lets say ExecutePlan() and its sub-functions like
ExecProcNode()...

Thanks to everybody on this group,
-Vikram Kalsi
MSEE PennStateUniv


pgsql-hackers by date:

Previous
From: "David Parker"
Date:
Subject: logging sql from JDBC
Next
From: Manfred Koizar
Date:
Subject: Re: WAL replay failure after file truncation(?)