1 /*-------------------------------------------------------------------------
4 * POSTGRES attribute number definitions.
7 * Copyright (c) 1994, Regents of the University of California
9 * $Id: attnum.h,v 1.6 1997/09/08 02:34:02 momjian Exp $
11 *-------------------------------------------------------------------------
18 * user defined attribute numbers start at 1. -ay 2/95
20 typedef int16 AttrNumber;
22 #define InvalidAttrNumber 0
29 * AttributeNumberIsValid --
30 * True iff the attribute number is valid.
32 #define AttributeNumberIsValid(attributeNumber) \
33 ((bool) ((attributeNumber) != InvalidAttrNumber))
36 * AttrNumberIsForUserDefinedAttr --
37 * True iff the attribute number corresponds to an user defined attribute.
39 #define AttrNumberIsForUserDefinedAttr(attributeNumber) \
40 ((bool) ((attributeNumber) > 0))
43 * AttrNumberGetAttrOffset --
44 * Returns the attribute offset for an attribute number.
47 * Assumes the attribute number is for an user defined attribute.
49 #define AttrNumberGetAttrOffset(attNum) \
50 (AssertMacro(AttrNumberIsForUserDefinedAttr(attNum)) ? \
54 * AttributeOffsetGetAttributeNumber --
55 * Returns the attribute number for an attribute offset.
57 #define AttrOffsetGetAttrNumber(attributeOffset) \
58 ((AttrNumber) (1 + attributeOffset))