Re: It's possible to get pg_class oid from GETSTRUC macro?

From: Mark Kirkwood <mark(dot)kirkwood(at)catalyst(dot)net(dot)nz>
To: pgsql-hackers(at)postgresql(dot)org
Subject: Re: It's possible to get pg_class oid from GETSTRUC macro?
Date: 2010-06-13 03:55:25
Message-ID: 4C1456AD.3020109@catalyst.net.nz
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On 13/06/10 15:28, Mohammad Heykal Abdillah wrote:
> After i read PostgreSQL documentation, i found that pg_attribute contain
> "attrelid" that reference to pg_class oid. But after i look to
> "/src/include/catalog/pg_class.h" there is no member named "oid".
>
> This what i trying to acomplish using "heap_getnext" function:
>
> if (((Form_pg_class) GETSTRUCT(ht_1)->oid) == ((Form_pg_attribute)
> GETSTRUCT(ht_2)->attrelid)
> {
> //do something
> }
>
> But its always failed in compile time since pg_class doesnt have "oid"
> member. And it seem "t_tableOid" was not pg_class oid since when i
> compare "t_tableOid" and "(Form_pg_attribute) GETSTRUCT(ht_2)->attrelid"
> nothing match.
>
> My question is, how to get "oid" from pg_class? or is there any other
> solution you can suggest?
>
> Thank you.
>

Guess you could get the oid via:

HeapTupleGetOid(h_1);

regards

Mark

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Heikki Linnakangas 2010-06-13 05:24:24 Re: Proposal for 9.1: WAL streaming from WAL buffers
Previous Message Mohammad Heykal Abdillah 2010-06-13 03:28:51 It's possible to get pg_class oid from GETSTRUC macro?