1996-08-27 23:50:29 +02:00
|
|
|
/*-------------------------------------------------------------------------
|
|
|
|
*
|
1999-02-14 00:22:53 +01:00
|
|
|
* attnum.h
|
1997-09-07 07:04:48 +02:00
|
|
|
* POSTGRES attribute number definitions.
|
1996-08-27 23:50:29 +02:00
|
|
|
*
|
|
|
|
*
|
2003-08-04 04:40:20 +02:00
|
|
|
* Portions Copyright (c) 1996-2003, PostgreSQL Global Development Group
|
2000-01-26 06:58:53 +01:00
|
|
|
* Portions Copyright (c) 1994, Regents of the University of California
|
1996-08-27 23:50:29 +02:00
|
|
|
*
|
2003-11-29 23:41:33 +01:00
|
|
|
* $PostgreSQL: pgsql/src/include/access/attnum.h,v 1.18 2003/11/29 22:40:55 pgsql Exp $
|
1996-08-27 23:50:29 +02:00
|
|
|
*
|
|
|
|
*-------------------------------------------------------------------------
|
|
|
|
*/
|
1997-09-07 07:04:48 +02:00
|
|
|
#ifndef ATTNUM_H
|
1996-08-27 23:50:29 +02:00
|
|
|
#define ATTNUM_H
|
|
|
|
|
1996-10-31 06:58:01 +01:00
|
|
|
|
1996-08-27 23:50:29 +02:00
|
|
|
/*
|
|
|
|
* user defined attribute numbers start at 1. -ay 2/95
|
|
|
|
*/
|
1997-09-08 04:41:22 +02:00
|
|
|
typedef int16 AttrNumber;
|
1996-08-27 23:50:29 +02:00
|
|
|
|
1997-09-07 07:04:48 +02:00
|
|
|
#define InvalidAttrNumber 0
|
1996-08-27 23:50:29 +02:00
|
|
|
|
|
|
|
/* ----------------
|
1997-09-07 07:04:48 +02:00
|
|
|
* support macros
|
1996-08-27 23:50:29 +02:00
|
|
|
* ----------------
|
|
|
|
*/
|
|
|
|
/*
|
1999-05-25 18:15:34 +02:00
|
|
|
* AttributeNumberIsValid
|
1997-09-07 07:04:48 +02:00
|
|
|
* True iff the attribute number is valid.
|
1996-08-27 23:50:29 +02:00
|
|
|
*/
|
|
|
|
#define AttributeNumberIsValid(attributeNumber) \
|
1997-09-07 07:04:48 +02:00
|
|
|
((bool) ((attributeNumber) != InvalidAttrNumber))
|
1996-08-27 23:50:29 +02:00
|
|
|
|
|
|
|
/*
|
1999-05-25 18:15:34 +02:00
|
|
|
* AttrNumberIsForUserDefinedAttr
|
1997-09-07 07:04:48 +02:00
|
|
|
* True iff the attribute number corresponds to an user defined attribute.
|
1996-08-27 23:50:29 +02:00
|
|
|
*/
|
|
|
|
#define AttrNumberIsForUserDefinedAttr(attributeNumber) \
|
1997-09-07 07:04:48 +02:00
|
|
|
((bool) ((attributeNumber) > 0))
|
1996-08-27 23:50:29 +02:00
|
|
|
|
|
|
|
/*
|
1999-05-25 18:15:34 +02:00
|
|
|
* AttrNumberGetAttrOffset
|
1997-09-07 07:04:48 +02:00
|
|
|
* Returns the attribute offset for an attribute number.
|
1996-08-27 23:50:29 +02:00
|
|
|
*
|
|
|
|
* Note:
|
1997-09-07 07:04:48 +02:00
|
|
|
* Assumes the attribute number is for an user defined attribute.
|
1996-08-27 23:50:29 +02:00
|
|
|
*/
|
|
|
|
#define AttrNumberGetAttrOffset(attNum) \
|
1998-06-15 20:40:05 +02:00
|
|
|
( \
|
|
|
|
AssertMacro(AttrNumberIsForUserDefinedAttr(attNum)), \
|
|
|
|
((attNum) - 1) \
|
|
|
|
)
|
1996-08-27 23:50:29 +02:00
|
|
|
|
|
|
|
/*
|
1999-05-25 18:15:34 +02:00
|
|
|
* AttributeOffsetGetAttributeNumber
|
1997-09-07 07:04:48 +02:00
|
|
|
* Returns the attribute number for an attribute offset.
|
1996-08-27 23:50:29 +02:00
|
|
|
*/
|
|
|
|
#define AttrOffsetGetAttrNumber(attributeOffset) \
|
1997-09-07 07:04:48 +02:00
|
|
|
((AttrNumber) (1 + attributeOffset))
|
2001-10-28 07:26:15 +01:00
|
|
|
|
2001-11-05 18:46:40 +01:00
|
|
|
#endif /* ATTNUM_H */
|