Header And Logo

PostgreSQL
| The world's most advanced open source database.

pos.h

Go to the documentation of this file.
00001 /*-------------------------------------------------------------------------
00002  *
00003  * pos.h
00004  *    POSTGRES "position" definitions.
00005  *
00006  *
00007  * Portions Copyright (c) 1996-2013, PostgreSQL Global Development Group
00008  * Portions Copyright (c) 1994, Regents of the University of California
00009  *
00010  * src/include/storage/pos.h
00011  *
00012  *-------------------------------------------------------------------------
00013  */
00014 #ifndef POS_H
00015 #define POS_H
00016 
00017 
00018 /*
00019  * a 'position' used to be <pagenumber, offset> in postgres.  this has
00020  * been changed to just <offset> as the notion of having multiple pages
00021  * within a block has been removed.
00022  *
00023  * the 'offset' abstraction is somewhat confusing.  it is NOT a byte
00024  * offset within the page; instead, it is an offset into the line
00025  * pointer array contained on every page that store (heap or index)
00026  * tuples.
00027  */
00028 typedef bits16 PositionIdData;
00029 typedef PositionIdData *PositionId;
00030 
00031 /* ----------------
00032  *      support macros
00033  * ----------------
00034  */
00035 
00036 /*
00037  * PositionIdIsValid
00038  *      True iff the position identifier is valid.
00039  */
00040 #define PositionIdIsValid(positionId) \
00041     PointerIsValid(positionId)
00042 
00043 /*
00044  * PositionIdSetInvalid
00045  *      Make an invalid position.
00046  */
00047 #define PositionIdSetInvalid(positionId) \
00048     *(positionId) = (bits16) 0
00049 
00050 /*
00051  * PositionIdSet
00052  *      Sets a position identifier to the specified value.
00053  */
00054 #define PositionIdSet(positionId, offsetNumber) \
00055     *(positionId) = (offsetNumber)
00056 
00057 /*
00058  * PositionIdGetOffsetNumber
00059  *      Retrieve the offset number from a position identifier.
00060  */
00061 #define PositionIdGetOffsetNumber(positionId) \
00062     ((OffsetNumber) *(positionId))
00063 
00064 #endif   /* POS_H */