Re: Writing and Reading bytea

From: Heikki Linnakangas <heikki(dot)linnakangas(at)enterprisedb(dot)com>
To: Amit Gupta <amit(dot)pc(dot)gupta(at)gmail(dot)com>
Cc: pgsql-hackers(at)postgresql(dot)org, Robert Haas <robertmhaas(at)gmail(dot)com>, Emmanuel Cecchet <manu(at)frogthinker(dot)org>
Subject: Re: Writing and Reading bytea
Date: 2009-02-12 16:01:49
Message-ID: 499447ED.20104@enterprisedb.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: 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

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Heikki Linnakangas 2009-02-12 16:05:01 Re: Writing and Reading bytea
Previous Message Amit Gupta 2009-02-12 15:50:28 Writing and Reading bytea