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
|
|
|
*
|
|
|
|
*
|
2014-01-07 22:05:30 +01:00
|
|
|
* Portions Copyright (c) 1996-2014, 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
|
|
|
*
|
2010-09-20 22:08:53 +02:00
|
|
|
* src/include/access/attnum.h
|
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
|
|
|
/*
|
2014-05-06 18:12:18 +02:00
|
|
|
* user defined attribute numbers start at 1. -ay 2/95
|
1996-08-27 23:50:29 +02:00
|
|
|
*/
|
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
|
2008-04-05 03:58:20 +02:00
|
|
|
#define MaxAttrNumber 32767
|
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) \
|
2005-05-25 23:40:43 +02:00
|
|
|
((AttrNumber) (1 + (attributeOffset)))
|
2001-10-28 07:26:15 +01:00
|
|
|
|
2001-11-05 18:46:40 +01:00
|
|
|
#endif /* ATTNUM_H */
|