Re: Writing and Reading bytea - Mailing list pgsql-hackers

From Heikki Linnakangas
Subject Re: Writing and Reading bytea
Date
Msg-id 499447ED.20104@enterprisedb.com
Whole thread Raw
In response to Writing and Reading bytea  (Amit Gupta <amit.pc.gupta@gmail.com>)
List pgsql-hackers
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


pgsql-hackers by date:

Previous
From: Amit Gupta
Date:
Subject: Writing and Reading bytea
Next
From: Heikki Linnakangas
Date:
Subject: Re: Writing and Reading bytea