mirror of
https://github.com/postgres/postgres.git
synced 2025-07-02 09:02:37 +03:00
currently support this because we must be able to build Vars referencing join columns, and varattno is only 16 bits wide. Perhaps this should be improved in future, but considering that it never came up before, I'm not sure the problem is worth much effort. Per bug #4070 from Marcello Ceschia. The problem seems largely academic in 8.0 and 7.4, because they have (different) O(N^2) performance issues with such wide joins, but back-patch all the way anyway.
65 lines
1.6 KiB
C
65 lines
1.6 KiB
C
/*-------------------------------------------------------------------------
|
|
*
|
|
* attnum.h
|
|
* POSTGRES attribute number definitions.
|
|
*
|
|
*
|
|
* Portions Copyright (c) 1996-2008, PostgreSQL Global Development Group
|
|
* Portions Copyright (c) 1994, Regents of the University of California
|
|
*
|
|
* $PostgreSQL: pgsql/src/include/access/attnum.h,v 1.25 2008/04/05 01:58:20 tgl Exp $
|
|
*
|
|
*-------------------------------------------------------------------------
|
|
*/
|
|
#ifndef ATTNUM_H
|
|
#define ATTNUM_H
|
|
|
|
|
|
/*
|
|
* user defined attribute numbers start at 1. -ay 2/95
|
|
*/
|
|
typedef int16 AttrNumber;
|
|
|
|
#define InvalidAttrNumber 0
|
|
#define MaxAttrNumber 32767
|
|
|
|
/* ----------------
|
|
* support macros
|
|
* ----------------
|
|
*/
|
|
/*
|
|
* AttributeNumberIsValid
|
|
* True iff the attribute number is valid.
|
|
*/
|
|
#define AttributeNumberIsValid(attributeNumber) \
|
|
((bool) ((attributeNumber) != InvalidAttrNumber))
|
|
|
|
/*
|
|
* AttrNumberIsForUserDefinedAttr
|
|
* True iff the attribute number corresponds to an user defined attribute.
|
|
*/
|
|
#define AttrNumberIsForUserDefinedAttr(attributeNumber) \
|
|
((bool) ((attributeNumber) > 0))
|
|
|
|
/*
|
|
* AttrNumberGetAttrOffset
|
|
* Returns the attribute offset for an attribute number.
|
|
*
|
|
* Note:
|
|
* Assumes the attribute number is for an user defined attribute.
|
|
*/
|
|
#define AttrNumberGetAttrOffset(attNum) \
|
|
( \
|
|
AssertMacro(AttrNumberIsForUserDefinedAttr(attNum)), \
|
|
((attNum) - 1) \
|
|
)
|
|
|
|
/*
|
|
* AttributeOffsetGetAttributeNumber
|
|
* Returns the attribute number for an attribute offset.
|
|
*/
|
|
#define AttrOffsetGetAttrNumber(attributeOffset) \
|
|
((AttrNumber) (1 + (attributeOffset)))
|
|
|
|
#endif /* ATTNUM_H */
|