head	1.21;
access;
symbols
	release_4_2:1.21
	aix_ok:1.20
	Version_2_1:1.13
	Version_2:1.10
	C_Demo_1:1.4;
locks; strict;
comment	@ * @;


1.21
date	93.11.03.08.24.31;	author aoki;	state Exp;
branches;
next	1.20;

1.20
date	93.07.16.18.37.23;	author avi;	state Exp;
branches;
next	1.19;

1.19
date	92.05.28.20.24.15;	author mer;	state Exp;
branches;
next	1.18;

1.18
date	91.12.04.01.58.40;	author glass;	state Exp;
branches;
next	1.17;

1.17
date	91.05.16.22.21.29;	author kemnitz;	state Exp;
branches;
next	1.16;

1.16
date	91.05.13.16.55.59;	author kemnitz;	state Exp;
branches;
next	1.15;

1.15
date	91.05.01.02.50.07;	author cimarron;	state Exp;
branches;
next	1.14;

1.14
date	91.04.28.09.15.40;	author cimarron;	state Exp;
branches;
next	1.13;

1.13
date	90.11.20.15.53.32;	author sp;	state Exp;
branches;
next	1.12;

1.12
date	90.11.10.18.02.08;	author sp;	state Exp;
branches;
next	1.11;

1.11
date	90.08.17.08.50.49;	author cimarron;	state Exp;
branches;
next	1.10;

1.10
date	90.06.08.16.01.19;	author cimarron;	state Version_2;
branches;
next	1.9;

1.9
date	90.06.08.15.28.14;	author cimarron;	state Exp;
branches;
next	1.8;

1.8
date	90.06.07.18.20.12;	author cimarron;	state Exp;
branches;
next	1.7;

1.7
date	90.02.08.14.40.13;	author hong;	state Exp;
branches;
next	1.6;

1.6
date	89.09.25.11.26.01;	author cimarron;	state Exp;
branches;
next	1.5;

1.5
date	89.09.21.19.12.34;	author hirohama;	state Exp;
branches;
next	1.4;

1.4
date	89.09.05.17.06.43;	author mao;	state C_Demo_1;
branches;
next	1.3;

1.3
date	89.04.12.19.54.20;	author dillon;	state Exp;
branches;
next	1.2;

1.2
date	89.03.22.17.33.01;	author muir;	state Stab;
branches;
next	1.1;

1.1
date	89.01.17.05.54.10;	author cimarron;	state Exp;
branches;
next	;


desc
@@


1.21
log
@fix broken prs2 protos
remove rules/rlock.h, access/xcxt.h, access/newam.h (dead headers
  with residual dependencies)
@
text
@/* ----------------------------------------------------------------
 *   FILE
 *	htup.h
 *
 *   DESCRIPTION
 *	POSTGRES heap tuple definitions.
 *
 *   NOTES
 *
 *   IDENTIFICATION
 *	$Header$
 * ----------------------------------------------------------------
 */

#ifndef	HTupIncluded		/* Include this file only once */
#define HTupIncluded	1

#include "tmp/postgres.h"	/* XXX obsolete, for XID, etc. */

#include "access/attnum.h"
#include "storage/form.h"
#include "storage/page.h"  		/* just to reduce levels of #include */
#include "storage/part.h"  		/* just to reduce levels of #include */
#include "storage/itemptr.h"
#include "rules/prs2locks.h"
#include "utils/nabstime.h"

#define MinHeapTupleBitmapSize	32		/* 8 * 4 */

/* check these, they are likely to be more severely limited by t_hoff */

#define MaxHeapAttributeNumber	1600		/* 8 * 200 */

/*-----------------------------------------------------------
 * NOTE:
 * A rule lock has 2 different representations:
 *    The disk representation (t_lock.l_ltid) is an ItemPointer
 * to the actual rule lock data (stored somewhere else in the disk page).
 * In this case `t_locktype' has the value DISK_RULE_LOCK.
 *    The main memory representation (t_lock.l_lock) is a pointer
 * (RuleLock) to a (palloced) structure. In this case `t_locktype' has
 * the value MEM_RULE_LOCK.
 */

#define DISK_RULE_LOCK	'd'
#define MEM_RULE_LOCK	'm'

/*
 * to avoid wasting space, the attributes should be layed out in such a
 * way to reduce structure padding.
 */

typedef struct HeapTupleData {

    /* size is unsigned int */

	Size		t_len;		/* length of entire tuple */

					/* anchor point TID -- 6 bytes, was
					 * commented out, and I have removed
					 * it from the file -mer 5/27/92 
					 */

	ItemPointerData	t_ctid;		/* current TID of this tuple */

					/* keep these here as padding */


	ItemPointerData	t_chain;	/* replaced tuple TID */

					/* keep these here as padding */

	union {
		ItemPointerData	l_ltid;	/* TID of the lock */
		RuleLock	l_lock;	/* internal lock format */
	}		t_lock;

	ObjectId	t_oid;		/* OID of this tuple -- 4 bytes */

	CommandId	t_cmin;		/* insert CID stamp -- 2 bytes each */
	CommandId	t_cmax;		/* delete CommandId stamp */

	TransactionId	t_xmin;		/* insert XID stamp -- 4 bytes each */
	TransactionId	t_xmax;		/* delete XID stamp */

	AbsoluteTime	t_tmin, t_tmax;	/* time stamps -- 4 bytes each */

	AttributeNumber	t_natts;	/* number of attributes */

	char		t_vtype;	/* `d', `i', `r' */
	char		t_infomask;	/* used for various stuff in getattr */
	char		t_locktype;	/* type of rule lock representation*/
	uint8		t_hoff;		/* sizeof tuple header */


	char		t_bits[MinHeapTupleBitmapSize / 8];
					/* bit map of domains */
} HeapTupleData;	/* MORE DATA FOLLOWS AT END OF STRUCT */

typedef HeapTupleData	*HeapTuple;

/* three files? */

#ifndef	RuleLockAttributeNumber
#define SelfItemPointerAttributeNumber		(-1)
#define RuleLockAttributeNumber			(-2)
#define ObjectIdAttributeNumber			(-3)
#define MinTransactionIdAttributeNumber		(-4)
#define MinCommandIdAttributeNumber		(-5)
#define MaxTransactionIdAttributeNumber		(-6)
#define MaxCommandIdAttributeNumber		(-7)
#define ChainItemPointerAttributeNumber		(-8)
#define AnchorItemPointerAttributeNumber	(-9)
#define MinAbsoluteTimeAttributeNumber		(-10)
#define MaxAbsoluteTimeAttributeNumber		(-11)
#define VersionTypeAttributeNumber		(-12)
#define FirstLowInvalidHeapAttributeNumber	(-13)
#endif	/* !defined(RuleLockAttributeNumber) */

/* ----------------
 *	support macros
 * ----------------
 */
#ifndef	GETSTRUCT
#define GETSTRUCT(TUP)	(((char *)(TUP)) + ((HeapTuple)(TUP))->t_hoff)

/*
 *	BITMAPLEN(NATTS)	- compute size of aligned bitmap
 *	u_int2	NATTS;
 *
 *	Computes minimum size of bitmap given number of domains.
 */
#define BITMAPLEN(NATTS)\
	((((((int)NATTS - 1) >> 3) + 4 - (MinHeapTupleBitmapSize >> 3)) & ~03) + (MinHeapTupleBitmapSize >> 3))

/*
 *	USEDBITMAPLEN(TUP)	- compute length of bitmap used
 *	struct	tuple	*TUP;
 */
#define USEDBITMAPLEN(TUP)\
	(1 + (((TUP)->t_natts - 1) >> 3))
#endif

/*
 * HeapTupleIsValid
 *	True iff the heap tuple is valid.
 */
#define	HeapTupleIsValid(tuple)	PointerIsValid(tuple)

/*
 * HeapTupleGetForm
 *	Returns the formated user attribute values of a heap tuple.
 */
#define HeapTupleGetForm(tuple) \
    ((Form) ((char *)(tuple) + (tuple)->t_hoff))

/* Various information about the tuple used by getattr() */

#define HeapTupleNoNulls(tuple) (!(((HeapTuple) (tuple))->t_infomask & 0x01))
#define HeapTupleAllFixed(tuple) (!(((HeapTuple) (tuple))->t_infomask & 0x02))

#define HeapTupleSetNull(tuple) (((HeapTuple) (tuple))->t_infomask |= 0x01)
#define HeapTupleSetVarlena(tuple) (((HeapTuple) (tuple))->t_infomask |= 0x02)

#endif	/* !defined(HTupIncluded) */
@


1.20
log
@time cleanup
@
text
@d1 5
a5 2
/*
 * htup.h --
d7 6
a17 5
/*
 * Identification:
 */
#define HTUP_H	"$Header: /private/src/postgres/src/backend/access/RCS/htup.h,v 1.19 1992/05/28 20:24:15 mer Exp avi $"

d25 1
a25 1
#include "rules/rlock.h"
a31 3
#ifdef  vax
#define MaxHeapAttributeNumber	1584		/* 8 * 198 */
#else
a32 1
#endif
@


1.19
log
@xids and cids are longs and shorts resp.  Also fix the declaration of
heaptuple struct so that it is readable. Finally, rearrange the order
of the fields to avoid wasted space (padding by compiler).
@
text
@d12 1
a12 1
#define HTUP_H	"$Header: /private/mer/pg.latest/src/lib/H/access/RCS/htup.h,v 1.18 1991/12/04 01:58:40 glass Exp mer $"
d22 1
d86 1
a86 1
	ABSTIME		t_tmin, t_tmax;	/* time stamps -- 4 bytes each */
@


1.18
log
@unterminated comment
@
text
@d12 1
a12 1
#define HTUP_H	"$Header: ../src/lib/H/access/RCS/htup.h,v 1.17 91/05/16 22:21:29 kemnitz Exp Locker: glass $"
d58 4
a61 1
	/* this is six bytes long */
a62 5
	/* ItemPointerData	t_anchor;*/	/* anchor point TID */

	/* keep these chars here as padding */


d65 1
a65 1
	/* keep these here as padding */
d70 1
a70 1
	/* keep these here as padding */
d77 1
a77 8
	/* four bytes long */

	ObjectId	t_oid;		/* OID of this tuple */

	/* char[5] each */

	XID		t_xmin;		/* insert XID stamp */
	XID		t_xmax;		/* delete XID stamp */
d79 2
a80 1
	/* one byte each */
d82 2
a83 2
	CID		t_cmin;		/* insert CID stamp */
	CID		t_cmax;		/* delete CID stamp */
d85 1
a85 1
	/* four bytes each */
a86 2
	ABSTIME		t_tmin, t_tmax;	/* time stamps */

d89 2
a90 2
    /* one byte each */

d93 1
a93 2
	char		t_vtype;	/* `d', `i', `r' */
	char		t_infomask; /* used for various stuff in getattr() */
@


1.17
log
@new smaller tuples
@
text
@d12 1
a12 1
#define HTUP_H	"$Header: RCS/htup.h,v 1.16 91/05/13 16:55:59 kemnitz Exp Locker: kemnitz $"
d60 1
a60 1
	/* ItemPointerData	t_anchor;	/* anchor point TID */
@


1.16
log
@Reorganized tuple header and added infomask.
@
text
@d12 1
a12 1
#define HTUP_H	"$Header: RCS/htup.h,v 1.15 91/05/01 02:50:07 cimarron Exp Locker: cimarron $"
d60 1
a60 1
	ItemPointerData	t_anchor;	/* anchor point TID */
@


1.15
log
@round II of converting simple functions to macros + code cleaning in general
@
text
@d12 1
a12 1
#define HTUP_H	"$Header: RCS/htup.h,v 1.14 91/04/28 09:15:40 cimarron Exp Locker: cimarron $"
d47 5
d53 3
d57 8
d66 8
a73 1
	char		t_locktype;	/* type of rule lock representation*/
d78 3
d82 3
d86 4
a90 1
	XID		t_xmax;		/* delete XID stamp */
d92 3
a94 2
	ItemPointerData	t_chain;	/* replaced tuple TID */
	ItemPointerData	t_anchor;	/* anchor point TID */
d96 1
d98 4
d104 2
d166 8
@


1.14
log
@Converted IsValid code into macros and added an improved NodeIsType scheme
@
text
@d12 1
a12 1
#define HTUP_H	"$Header: RCS/htup.h,v 1.13 90/11/20 15:53:32 sp Exp Locker: cimarron $"
d90 4
d124 2
a125 5
extern
Form
HeapTupleGetForm ARGS((
	HeapTuple	tuple
));
@


1.13
log
@"struct tuple", "struct ituple" and some hash defines (like "T_OID",
"T_CTID", "MAXATTS" etc.) which used to be defined in "htup.h" are
now obsolete and replaced by "HeapTuple", "IndexTuple" etc.
All these new definitions are in "htup.h" and "itup.h".
@
text
@d12 1
a12 1
#define HTUP_H	"$Header: RCS/htup.h,v 1.12 90/11/10 18:02:08 sp Exp Locker: sp $"
d114 1
a114 5
extern
bool
HeapTupleIsValid ARGS((
	HeapTuple	tuple
));
a124 74
#ifdef OBSOLETE
/* ----------------------------------------------------------------
 *			old stuff from tuple.h
 * ----------------------------------------------------------------
 */

/* check these, they are likely to be more severely limited by t_hoff */
#define	MAXIATTS 8
#define	MINATTS	32		/* 8 * 4 */
#ifdef	vax
#define	MAXATTS	1584		/* 8 * 198 */
#else
#define	MAXATTS	1600		/* 8 * 200 */
#endif

struct	tuple	{
	uint32		t_len;		/* length of entire tuple */
	ItemPointerData	t_ctid;		/* current TID of this tuple */
	char		t_locktype;	/* type of rule lock representation*/
	union {
		ItemPointerData	l_ltid;		/* TID of the lock */
		RuleLock	l_lock;		/* internal lock format */
	}		t_lock;
	OID		t_oid;		/* OID of this tuple */
	XID		t_xmin;		/* insert XID stamp */
	CID		t_cmin;		/* insert CID stamp */
	XID		t_xmax;		/* delete XID stamp */
	CID		t_cmax;		/* delete CID stamp */
	ItemPointerData	t_chain;	/* replaced tuple TID */
	ItemPointerData	t_anchor;	/* anchor point TID */
	ABSTIME		t_tmin, t_tmax;	/* time stamps */
	uint16		t_natts;	/* number of attributes */
	uint8		t_hoff;		/* sizeof tuple header */
	char		t_vtype;	/* `d', `i', `r' */
	char		t_bits[MINATTS / 8];
					/* bit map of domains */
};	/* MORE DATA FOLLOWS AT END OF STRUCT */

struct	ituple {
	ItemPointerData	t_ctid;		/* current TID of this tuple */
	union {
		ItemPointerData	l_ltid;		/* TID of the lock */
		RuleLock	l_lock;		/* internal lock format */
	}		t_lock;
	ItemPointerData	t_tid;		/* reference TID to base tuple */
	char		t_bits[MAXIATTS / 8];	/* bitmap of domains */
};	/* MORE DATA FOLLOWS AT END OF STRUCT */

typedef	union {
	struct	tuple	tp_t;
	struct	ituple	tp_it;
	char		tp_ot[1];
} TUPLE;

/*	attnum codes for the internal tuple fields	*/

#ifndef T_CTID
#define	T_CTID	(-1)
#define	T_LOCK	(-2)
#define	T_TID	(-3)
#endif
#define	T_OID	(-3)
#define	T_XMIN	(-4)
#define	T_CMIN	(-5)
#define	T_XMAX	(-6)
#define	T_CMAX	(-7)
#define	T_CHAIN	(-8)
#define	T_ANCHOR	(-9)
#define	T_TMIN	(-10)
#define	T_TMAX	(-11)
#define	T_VTYPE	(-12)
#define	T_HLOW	(T_VTYPE - 1)

#endif OBSOLETE
@


1.12
log
@Both heap & index tuples have an extra field called: t_locktype
which specifies whether the rule lock is a RuleLock (i.e. a pointer)
or an item in some disk (buffer) page...
@
text
@d12 1
a12 1
#define HTUP_H	"$Header: RCS/htup.h,v 1.11 90/08/17 08:50:49 cimarron Exp $"
d129 1
a129 1

d201 2
@


1.11
log
@added pathnames to #include statements
@
text
@d12 1
a12 1
#define HTUP_H	"$Header: RCS/htup.h,v 1.10 90/06/08 16:01:19 cimarron Version_2 Locker: cimarron $"
d33 14
d50 1
d147 1
@


1.10
log
@removed dependency on tupsiz.h which is being obsoleted.
@
text
@d12 1
a12 1
#define HTUP_H	"$Header: RCS/htup.h,v 1.9 90/06/08 15:28:14 cimarron Exp $"
d14 1
a14 3
#ifndef C_H
#include "c.h"
#endif
d16 6
a21 25
#ifndef POSTGRES_H
#include "postgres.h"		/* XXX obsolete, for XID, etc. */
#endif

#ifndef	ATTNUM_H
# include "attnum.h"
#endif
#ifndef	FORM_H
# include "form.h"
#endif
#ifndef PAGE_H
#include "page.h"  /* just to reduce levels of #include */
#endif
#ifndef PART_H
#include "part.h"  /* just to reduce levels of #include */
#endif
#ifndef	ITEMPTR_H
# include "itemptr.h"
#endif
#ifndef	OID_H
# include "oid.h"
#endif
#ifndef	RLOCK_H
# include "rlock.h"
#endif
@


1.9
log
@change to obsolete tupsiz.h
@
text
@d12 1
a12 1
#define HTUP_H	"$Header: RCS/htup.h,v 1.8 90/06/07 18:20:12 cimarron Exp $"
a38 3
#endif
#ifndef	TUPSIZ_H
# include "tupsiz.h"
@


1.8
log
@made changes to simplify header include files
@
text
@d12 1
a12 1
#define HTUP_H	"$Header: RCS/htup.h,v 1.7 90/02/08 14:40:13 hong Exp $"
d58 1
a58 1
	TupleSize	t_len;		/* length of entire tuple */
@


1.7
log
@fix for hermes to reduce levels of #include nesting.
@
text
@d12 1
a12 1
#define HTUP_H	"$Header: RCS/htup.h,v 1.6 89/09/25 11:26:01 cimarron Exp Locker: hong $"
d138 71
@


1.6
log
@moved dynamic symbol stuff to syms.h
@
text
@d12 1
a12 1
#define HTUP_H	"$Header: RCS/htup.h,v 1.5 89/09/21 19:12:34 hirohama Exp $"
d18 1
d20 1
d27 6
@


1.5
log
@added ...SYMBOLS declarations
miscellaneous cleanup
@
text
@d12 1
a12 1
#define HTUP_H	"$Header: RCS/htup.h,v 1.4 89/09/05 17:06:43 mao C_Demo_1 Locker: hirohama $"
a129 4

#define HTUP_SYMBOLS \
	SymbolDecl(HeapTupleIsValid, "_HeapTupleIsValid"), \
	SymbolDecl(HeapTupleGetForm, "_HeapTupleGetForm")
@


1.4
log
@Working version of C-only demo
@
text
@a3 3
 *
 * Identification:
 *	$Header: /usr6/postgres/mao/postgres/src/lib/H/RCS/htup.h,v 1.3 89/04/12 19:54:20 dillon Exp $
d6 1
a6 1
#ifndef	HTupIncluded	/* Include this file only once. */
d9 4
a12 1
#include "postgres.h"
d18 1
a18 6
#include "attnum.h"
#include "form.h"
#include "itemptr.h"
#include "oid.h"
#include "tupsiz.h"
#include "rlock.h"
d20 19
d130 4
@


1.3
log
@c.h
@
text
@d6 1
a6 1
 *	$Header: /usr6/postgres/dillon/ptree/src/lib/H/RCS/htup.h,v 1.2 89/03/22 17:33:01 muir Stab $
@


1.2
log
@copyright removal
@
text
@d6 1
a6 1
 *	$Header: /usr6/postgres/muir/postgres/src/lib/H/RCS/htup.h,v 1.1 89/01/17 05:54:10 cimarron Exp $
d14 1
d16 1
@


1.1
log
@Initial revision
@
text
@a0 27

; /*
; * 
; * POSTGRES Data Base Management System
; * 
; * Copyright (c) 1988 Regents of the University of California
; * 
; * Permission to use, copy, modify, and distribute this software and its
; * documentation for educational, research, and non-profit purposes and
; * without fee is hereby granted, provided that the above copyright
; * notice appear in all copies and that both that copyright notice and
; * this permission notice appear in supporting documentation, and that
; * the name of the University of California not be used in advertising
; * or publicity pertaining to distribution of the software without
; * specific, written prior permission.  Permission to incorporate this
; * software into commercial products can be obtained from the Campus
; * Software Office, 295 Evans Hall, University of California, Berkeley,
; * Ca., 94720 provided only that the the requestor give the University
; * of California a free licence to any derived software for educational
; * and research purposes.  The University of California makes no
; * representations about the suitability of this software for any
; * purpose.  It is provided "as is" without express or implied warranty.
; * 
; */



d6 1
a6 1
 *	$Header: htup.h,v 1.1 88/11/11 16:37:06 postgres Exp $
@
