1 /*-------------------------------------------------------------------------
4 * POSTGRES attribute number definitions.
7 * Portions Copyright (c) 1996-2007, PostgreSQL Global Development Group
8 * Portions Copyright (c) 1994, Regents of the University of California
10 * $PostgreSQL: pgsql/src/include/access/attnum.h,v 1.23 2007/01/05 22:19:50 momjian Exp $
12 *-------------------------------------------------------------------------
19 * user defined attribute numbers start at 1. -ay 2/95
21 typedef int16 AttrNumber;
23 #define InvalidAttrNumber 0
30 * AttributeNumberIsValid
31 * True iff the attribute number is valid.
33 #define AttributeNumberIsValid(attributeNumber) \
34 ((bool) ((attributeNumber) != InvalidAttrNumber))
37 * AttrNumberIsForUserDefinedAttr
38 * True iff the attribute number corresponds to an user defined attribute.
40 #define AttrNumberIsForUserDefinedAttr(attributeNumber) \
41 ((bool) ((attributeNumber) > 0))
44 * AttrNumberGetAttrOffset
45 * Returns the attribute offset for an attribute number.
48 * Assumes the attribute number is for an user defined attribute.
50 #define AttrNumberGetAttrOffset(attNum) \
52 AssertMacro(AttrNumberIsForUserDefinedAttr(attNum)), \
57 * AttributeOffsetGetAttributeNumber
58 * Returns the attribute number for an attribute offset.
60 #define AttrOffsetGetAttrNumber(attributeOffset) \
61 ((AttrNumber) (1 + (attributeOffset)))