What the function name to get the contents table/tuple ?

From: Mohammad Heykal Abdillah <heykal(dot)abdillah(at)gmail(dot)com>
To: pgsql-hackers(at)postgresql(dot)org
Subject: What the function name to get the contents table/tuple ?
Date: 2010-06-01 07:49:53
Message-ID: 1275378593.31024.35.camel@claudia
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Using this code below (particularly heap_open) somehow i can fetch all
table column name, and put in on list of string. Before raw_parsetree is
processed by analyze part.

------start code ----------------
---------------------------------

RangeVar *relation = makeNode(RangeVar);
relation->schemaname = NULL;
relation->catalogname = NULL;
relation->relname = "pg_class"; //table name
relation->inhOpt = INH_DEFAULT;
relation->istemp = false ;
relation->alias = NULL;

Relation Rel;
LOCKMODE lockmode = AccessShareLock;

Rel = heap_open(TableSpaceRelationId,lockmode);
Value *attrname ;
TupleDesc td;
td = Rel->rd_att;

List *colnames;
colnames = NIL;
int z;
int maxatribut = td->natts;
Form_pg_attribute fpa;

for (z=0;z<maxatribut;z++)
{
fpa = td->attrs[z];
attrname = makeString(pstrdup(NameStr(fpa->attname)));
colnames = lappend(colnames,attrname); //this where list cols name
colected
}

------end code ----------------
---------------------------------

My question, is there same kind function that i can use to get table
content (tuple)?

Thank You.
--
Mohammad Heykal Abdillah <heykal(dot)abdillah(at)gmail(dot)com>

Browse pgsql-hackers by date

  From Date Subject
Next Message KaiGai Kohei 2010-06-01 08:39:41 [RFC] A tackle to the leaky VIEWs for RLS
Previous Message Heikki Linnakangas 2010-06-01 07:34:02 Re: Index only scans