Re: how to understand these macro defines such as ObjectIdAttributeNumber in sysattr.h? - Mailing list pgsql-hackers

From 土卜皿
Subject Re: how to understand these macro defines such as ObjectIdAttributeNumber in sysattr.h?
Date
Msg-id CADT5_1-m3P_pf+OKYMNwb+yr2-Cw8v=iqYQRXizH=DN2MC64NA@mail.gmail.com
Whole thread Raw
In response to Re: how to understand these macro defines such as ObjectIdAttributeNumber in sysattr.h?  (Michael Paquier <michael.paquier@gmail.com>)
Responses Re: how to understand these macro defines such as ObjectIdAttributeNumber in sysattr.h?
List pgsql-hackers
hi, Michael
  thanks a lot!   your reminding lead me go a step forward!
  the 7 attributes are system attributes of some table such as pg_class, pg_type. but now I have a new question:
 
where and when using these system attributes? 



2014-08-18 15:57 GMT+08:00 Michael Paquier <michael.paquier@gmail.com>:
On Mon, Aug 18, 2014 at 4:42 PM, 土卜皿 <pengcz.nwpu@gmail.com> wrote:
>    Recently, for understanding postgresql's optimizer,  I read and debug the
> source code. these two days,  I read these macros in sysattr.h:
>
> ...
> #define ObjectIdAttributeNumber (-2)
> ...
>
> and the relative codes, but I still did not know why authors designed them
> like that, especially the value '-2' ?
>
> what should I do if I want to see the thoughts behind them? thanks in
> advance!
Those values define the system attribute IDs associated to a relation.
You can have a look at the top of heap.c to see where they come from,
particularly the fields FormData_pg_attribute a1..a7.
Hope this helps.
Regards,
--
Michael

pgsql-hackers by date:

Previous
From: Heikki Linnakangas
Date:
Subject: Re: Index-only scans for GIST
Next
From: Asif Naeem
Date:
Subject: Re: [BUGS] BUG #9652: inet types don't support min/max