1996-08-28 03:59:28 +02:00
|
|
|
/*-------------------------------------------------------------------------
|
|
|
|
*
|
1999-02-14 00:22:53 +01:00
|
|
|
* pos.h
|
1997-09-07 07:04:48 +02:00
|
|
|
* POSTGRES "position" definitions.
|
1996-08-28 03:59:28 +02:00
|
|
|
*
|
|
|
|
*
|
2000-01-26 06:58:53 +01:00
|
|
|
* Portions Copyright (c) 1996-2000, PostgreSQL, Inc
|
|
|
|
* Portions Copyright (c) 1994, Regents of the University of California
|
1996-08-28 03:59:28 +02:00
|
|
|
*
|
2000-01-26 06:58:53 +01:00
|
|
|
* $Id: pos.h,v 1.9 2000/01/26 05:58:33 momjian Exp $
|
1996-08-28 03:59:28 +02:00
|
|
|
*
|
|
|
|
*-------------------------------------------------------------------------
|
|
|
|
*/
|
1997-09-07 07:04:48 +02:00
|
|
|
#ifndef POS_H
|
1996-08-28 03:59:28 +02:00
|
|
|
#define POS_H
|
|
|
|
|
1999-07-15 17:21:54 +02:00
|
|
|
#include "storage/off.h"
|
|
|
|
|
1996-08-28 03:59:28 +02:00
|
|
|
/*
|
|
|
|
* a 'position' used to be <pagenumber, offset> in postgres. this has
|
|
|
|
* been changed to just <offset> as the notion of having multiple pages
|
|
|
|
* within a block has been removed.
|
|
|
|
*
|
1997-09-07 07:04:48 +02:00
|
|
|
* the 'offset' abstraction is somewhat confusing. it is NOT a byte
|
1996-08-28 03:59:28 +02:00
|
|
|
* offset within the page; instead, it is an offset into the line
|
|
|
|
* pointer array contained on every page that store (heap or index)
|
|
|
|
* tuples.
|
|
|
|
*/
|
1997-09-08 04:41:22 +02:00
|
|
|
typedef bits16 PositionIdData;
|
1997-09-07 07:04:48 +02:00
|
|
|
typedef PositionIdData *PositionId;
|
1996-08-28 03:59:28 +02:00
|
|
|
|
|
|
|
/* ----------------
|
1997-09-07 07:04:48 +02:00
|
|
|
* support macros
|
1996-08-28 03:59:28 +02:00
|
|
|
* ----------------
|
|
|
|
*/
|
|
|
|
|
|
|
|
/*
|
1999-05-25 18:15:34 +02:00
|
|
|
* PositionIdIsValid
|
1997-09-07 07:04:48 +02:00
|
|
|
* True iff the position identifier is valid.
|
1996-08-28 03:59:28 +02:00
|
|
|
*/
|
|
|
|
#define PositionIdIsValid(positionId) \
|
1997-09-07 07:04:48 +02:00
|
|
|
PointerIsValid(positionId)
|
1996-08-28 03:59:28 +02:00
|
|
|
|
|
|
|
/*
|
1999-05-25 18:15:34 +02:00
|
|
|
* PositionIdSetInvalid
|
1997-09-07 07:04:48 +02:00
|
|
|
* Make an invalid position.
|
1996-08-28 03:59:28 +02:00
|
|
|
*/
|
|
|
|
#define PositionIdSetInvalid(positionId) \
|
1997-09-07 07:04:48 +02:00
|
|
|
*(positionId) = (bits16) 0
|
1996-08-28 03:59:28 +02:00
|
|
|
|
|
|
|
/*
|
1999-05-25 18:15:34 +02:00
|
|
|
* PositionIdSet
|
1997-09-07 07:04:48 +02:00
|
|
|
* Sets a position identifier to the specified value.
|
1996-08-28 03:59:28 +02:00
|
|
|
*/
|
|
|
|
#define PositionIdSet(positionId, offsetNumber) \
|
1997-09-07 07:04:48 +02:00
|
|
|
*(positionId) = (offsetNumber)
|
1996-08-28 03:59:28 +02:00
|
|
|
|
|
|
|
/*
|
1999-05-25 18:15:34 +02:00
|
|
|
* PositionIdGetOffsetNumber
|
1997-09-07 07:04:48 +02:00
|
|
|
* Retrieve the offset number from a position identifier.
|
1996-08-28 03:59:28 +02:00
|
|
|
*/
|
|
|
|
#define PositionIdGetOffsetNumber(positionId) \
|
1997-09-07 07:04:48 +02:00
|
|
|
((OffsetNumber) *(positionId))
|
1996-08-28 03:59:28 +02:00
|
|
|
|
1998-09-01 06:40:42 +02:00
|
|
|
#endif /* POS_H */
|