Amit Gupta wrote:
> The following code didn't work:
> ....
> pg_partrel = heap_open(PartitionRelationId, AccessShareLock);
> pg_partscan = systable_beginscan(pg_partrel, PartitionParentIndexId, true,
> SnapshotNow, 1, &skey);
> while (HeapTupleIsValid(pg_parttup= systable_getnext(pg_partscan)))
> {
> Form_pg_partition pg_part = (Form_pg_partition) GETSTRUCT(pg_parttup);
> Datum attr = heap_getattr(tuple, pg_part->partkey, rel->rd_att, &isnull)
> Datum min_part_attr = (Datum) (&pg_part->minval);
> Datum max_part_attr = (Datum) (&pg_part->maxval);
> ......
>
> }
You need to use heap_getattr to access columns after the first variable
length column.
-- Heikki Linnakangas EnterpriseDB http://www.enterprisedb.com