head 1.17; access; symbols release_4_2:1.17 aix_ok:1.15 Version_2_1:1.11 Version_2:1.8 C_Demo_1:1.5; locks; strict; comment @ * @; 1.17 date 94.02.07.11.28.11; author aoki; state Exp; branches; next 1.16; 1.16 date 93.11.03.08.24.31; author aoki; state Exp; branches; next 1.15; 1.15 date 92.05.05.18.54.59; author mer; state Exp; branches; next 1.14; 1.14 date 91.11.14.15.05.19; author jolly; state Exp; branches; next 1.13; 1.13 date 91.07.22.22.21.26; author mao; state Exp; branches; next 1.12; 1.12 date 91.05.01.02.50.03; author cimarron; state Exp; branches; next 1.11; 1.11 date 91.02.06.18.17.50; author cimarron; state Exp; branches; next 1.10; 1.10 date 90.08.18.00.39.53; author cimarron; state Exp; branches; next 1.9; 1.9 date 90.08.17.08.50.44; author cimarron; state Exp; branches; next 1.8; 1.8 date 90.05.25.14.06.44; author mao; state Version_2; branches; next 1.7; 1.7 date 90.03.31.18.56.53; author cimarron; state Exp; branches; next 1.6; 1.6 date 89.09.29.18.51.21; author hirohama; state Exp; branches; next 1.5; 1.5 date 89.09.05.17.06.33; author mao; state C_Demo_1; branches; next 1.4; 1.4 date 89.08.10.17.27.10; author hirohama; state Exp; branches; next 1.3; 1.3 date 89.08.09.18.13.45; author cimarron; state Exp; branches; next 1.2; 1.2 date 89.03.22.17.32.59; author muir; state Stab; branches; next 1.1; 1.1 date 89.01.17.05.54.08; author cimarron; state Exp; branches; next ; desc @@ 1.17 log @proto fixes @ text @/* ---------------------------------------------------------------- * FILE * heapam.h * * DESCRIPTION * POSTGRES heap access method definitions. * * NOTES * * IDENTIFICATION * $Header: /import/faerie/faerie/aoki/postgres/src/backend/access/RCS/heapam.h,v 1.16 1993/11/03 08:24:31 aoki Exp aoki $ * ---------------------------------------------------------------- */ #ifndef HeapAMIncluded /* Include this file only once */ #define HeapAMIncluded 1 #include #include "tmp/postgres.h" #include "access/att.h" #include "access/attnum.h" #include "access/htup.h" #include "access/relscan.h" #include "access/skey.h" #include "access/tqual.h" #include "access/tupdesc.h" #include "storage/smgr.h" #include "rules/prs2locks.h" #include "utils/rel.h" /* ---------------------------------------------------------------- * heap access method statistics * ---------------------------------------------------------------- */ typedef struct HeapAccessStatisticsData { time_t init_global_timestamp; /* time global statistics started */ time_t local_reset_timestamp; /* last time local reset was done */ time_t last_request_timestamp; /* last time stats were requested */ int global_open; int global_openr; int global_close; int global_beginscan; int global_rescan; int global_endscan; int global_getnext; int global_fetch; int global_insert; int global_delete; int global_replace; int global_markpos; int global_restrpos; int global_BufferGetRelation; int global_RelationIdGetRelation; int global_RelationIdGetRelation_Buf; int global_RelationNameGetRelation; int global_getreldesc; int global_heapgettup; int global_RelationPutHeapTuple; int global_RelationPutLongHeapTuple; int local_open; int local_openr; int local_close; int local_beginscan; int local_rescan; int local_endscan; int local_getnext; int local_fetch; int local_insert; int local_delete; int local_replace; int local_markpos; int local_restrpos; int local_BufferGetRelation; int local_RelationIdGetRelation; int local_RelationIdGetRelation_Buf; int local_RelationNameGetRelation; int local_getreldesc; int local_heapgettup; int local_RelationPutHeapTuple; int local_RelationPutLongHeapTuple; } HeapAccessStatisticsData; typedef HeapAccessStatisticsData *HeapAccessStatistics; #define IncrHeapAccessStat(x) \ (heap_access_stats == NULL ? 0 : (heap_access_stats->x)++) extern HeapAccessStatistics heap_access_stats; /* ---------------- * function prototypes for heap access method * ---------------- */ /* heap_create, heap_creatr, and heap_destroy are declared in catalog/heap.h */ #include "lib/heap.h" extern Relation heap_open(); extern Relation heap_openr(); extern void heap_close(); extern HeapTuple heap_fetch(); extern ObjectId heap_insert(); extern RuleLock heap_delete(); extern RuleLock heap_replace(); extern char * heap_getattr(); extern HeapScanDesc heap_beginscan(); extern void heap_rescan(); extern void heap_endscan(); extern void heap_markpos(); extern void heap_restrpos(); extern HeapTuple heap_getnext(); extern int heap_attisnull(); extern int heap_sysattrlen(); extern bool heap_sysattrbyval(); extern HeapTuple heap_addheader(); extern HeapTuple heap_copysimple(); extern HeapTuple heap_copytuple(); extern void heap_deformtuple(); extern HeapTuple heap_formtuple(); extern HeapTuple heap_modifytuple(); extern char *fastgetattr(); extern Size ComputeDataSize(); extern void DataFill(); /* ---------------- * misc * ---------------- */ extern RuleLock doinsert ARGS(( Relation relation, HeapTuple heapTuple )); /* ---------------------------------------------------------------- * obsolete heap access method interfaces * ---------------------------------------------------------------- */ /* * RelationNameCreateHeapRelation -- * Returns relation id of a newly created cataloged heap relation. */ #define RelationNameCreateHeapRelation(relname, arch, natts, smgr, tupdesc) \ heap_create(relname, arch, natts, smgr, tupdesc) #define amcreate(relname, arch, natts, smgr, tupdesc) \ heap_create(relname, arch, natts, smgr, tupdesc) /* * RelationNameCreateTemporaryRelation -- * Creates a temporary heap relation. */ #define RelationNameCreateTemporaryRelation(relname, natts, att) \ heap_creatr(relname, natts, DEFAULT_SMGR, att) #define amcreatr(relname, natts, smgr, att) \ heap_creatr(relname, natts, smgr, att) /* * RelationNameDestroyHeapRelation -- * Destroys a heap relation. */ #define RelationNameDestroyHeapRelation(relationName) \ heap_destroy(relationName) #define amdestroy(relationName) \ heap_destroy(relationName) /* * ObjectIdOpenHeapRelation -- * Opens a heap relation by its object identifier. */ #define ObjectIdOpenHeapRelation(relationId) \ heap_open(relationId) #define amopen(relid) \ heap_open(relid) /* * RelationNameOpenHeapRelation -- * Opens a heap relation by name. */ #define RelationNameOpenHeapRelation(relationName) \ heap_openr(relationName) #define amopenr(relationName) \ heap_openr(relationName) /* * RelationCloseHeapRelation -- * Closes a heap relation. */ #define RelationCloseHeapRelation(relation) \ heap_close(relation) #define amclose(relation) \ heap_close(relation) /* * RelationGetHeapTupleByItemPointer -- * Retrieves a heap tuple by its item pointer. */ #define RelationGetHeapTupleByItemPointer(relation, timeQual, tid, b) \ heap_fetch(relation, timeQual, tid, b) #define amgetunique(relation, timeQual, tid, b) \ heap_fetch(relation, timeQual, tid, b) /* * RelationInsertHeapTuple -- * Inserts a heap tuple. */ #define RelationInsertHeapTuple(relation, heapTuple, offsetOutP) \ heap_insert(relation, heapTuple, offsetOutP) #define aminsert(relation, heapTuple, offsetOutP) \ heap_insert(relation, heapTuple, offsetOutP) /* * RelationDeleteHeapTuple -- * Deletes a heap tuple. */ #define RelationDeleteHeapTuple(relation, heapItem) \ heap_delete(relation, heapItem) #define amdelete(relation, heapItem) \ heap_delete(relation, heapItem) /* * RelationReplaceHeapTuple -- * Replaces a heap tuple. OffsetOutP is obsolete. */ #define RelationReplaceHeapTuple(relation, heapItem, tuple, offsetOutP) \ heap_replace(relation, heapItem, tuple) #define amreplace(relation, heapItem, tuple) \ heap_replace(relation, heapItem, tuple) /* * HeapTupleGetAttributeValue -- * Returns an attribute of a heap tuple. */ #define HeapTupleGetAttributeValue(tup, b, attnum, att, isnull) \ PointerGetDatum(heap_getattr(tup, b, attnum, att, isnull)) /* * RelationBeginHeapScan -- * General access method initialize heap scan routine. */ #define RelationBeginHeapScan(relation, atend, timeQual, nkeys, key) \ heap_beginscan(relation, atend, timeQual, nkeys, key) #define ambeginscan(relation, atend, timeQual, nkeys, key) \ heap_beginscan(relation, atend, timeQual, nkeys, key) /* * HeapScanRestart -- * General access method restart heap scan routine. */ #define HeapScanRestart(scan, restartScanAtEnd, key) \ heap_rescan(scan, restartScanAtEnd, key) #define amrescan(scan, restartScanAtEnd, key) \ heap_rescan(scan, restartScanAtEnd, key) /* * HeapScanEnd -- * General access method end heap scan routine. */ #define HeapScanEnd(scan) \ heap_endscan(scan) #define amendscan(scan) \ heap_endscan(scan) /* * HeapScanMarkPosition -- * General access method mark heap scan position routine. */ #define HeapScanMarkPosition(scan) \ heap_markpos(scan) #define ammarkpos(scan) \ heap_markpos(scan) /* * HeapScanRestorePosition -- * General access method restore heap scan position routine. */ #define HeapScanRestorePosition(scan) \ heap_restrpos(scan) #define amrestrpos(scan) \ heap_restrpos(scan) /* * HeapScanGetNextTuple -- * General access method get heap tuple routine. */ #define HeapScanGetNextTuple(scan, backwards, bufferOutP) \ heap_getnext(scan, backwards, bufferOutP) #define amgetnext(scan, backwards, bufferOutP) \ heap_getnext(scan, backwards, bufferOutP) /* * sysattrlen */ #define sysattrlen(attno) \ heap_sysattrlen(attno) /* * sysattrbyval */ #define sysattrbyval(attno) \ heap_sysattrbyval(attno) /* * amgetattr */ #define amgetattr(tup, b, attnum, att, isnull) \ heap_getattr(tup, b, attnum, att, isnull) /* * palloctup */ #define palloctup(tuple, buffer, relation) \ heap_copytuple(tuple, buffer, relation) #endif /* !defined(HeapAMIncluded) */ @ 1.16 log @fix broken prs2 protos remove rules/rlock.h, access/xcxt.h, access/newam.h (dead headers with residual dependencies) @ text @d11 1 a11 1 * $Header$ d122 1 d124 1 d128 4 @ 1.15 log @heap_insert() now returns the oid of inserted tuple @ text @d1 5 a5 2 /* * heapam.h -- d7 6 a17 5 /* * Identification: */ #define HEAPAM_H "$Header: /users/mer/pg/src/lib/H/access/RCS/heapam.h,v 1.14 1991/11/14 15:05:19 jolly Exp mer $" d32 1 a32 1 #include "rules/rlock.h" @ 1.14 log @the declarations for heap_create(), heap_creatr(), and heap_destroy() are now in "lib/heap.h" @ text @d12 1 a12 1 #define HEAPAM_H "$Header: access/RCS/heapam.h,v 1.13 91/07/22 22:21:26 mao Exp Locker: jolly $" d103 1 a103 1 extern RuleLock heap_insert(); @ 1.13 log @jukebox storage manager installation @ text @d12 1 a12 1 #define HEAPAM_H "$Header: /users/mao/postgres/src/lib/H/access/RCS/heapam.h,v 1.12 1991/05/01 02:50:03 cimarron Exp $" d97 2 a98 3 extern ObjectId heap_create(); extern Relation heap_creatr(); extern void heap_destroy(); @ 1.12 log @round II of converting simple functions to macros + code cleaning in general @ text @d12 1 a12 1 #define HEAPAM_H "$Header: RCS/heapam.h,v 1.11 91/02/06 18:17:50 cimarron Exp Locker: cimarron $" d26 2 d143 2 a144 2 #define RelationNameCreateHeapRelation(relname, arch, natts, tupdesc) \ heap_create(relname, arch, natts, tupdesc) d146 2 a147 2 #define amcreate(relname, arch, natts, tupdesc) \ heap_create(relname, arch, natts, tupdesc) d154 1 a154 1 heap_creatr(relname, natts, att) d156 2 a157 2 #define amcreatr(relname, natts, att) \ heap_creatr(relname, natts, att) @ 1.11 log @preliminary checkin for access method and system cache changes @ text @d12 1 a12 1 #define HEAPAM_H "$Header: RCS/heapam.h,v 1.10 90/08/18 00:39:53 cimarron Exp Locker: cimarron $" a55 3 int global_ObjectIdOpenHeapRelation; int global_RelationNameOpenHeapRelation; int global_RelationCloseHeapRelation; a77 3 int local_ObjectIdOpenHeapRelation; int local_RelationNameOpenHeapRelation; int local_RelationCloseHeapRelation; d92 1 a92 1 * new prototypes d113 8 d122 1 a122 1 * old prototypes d125 6 d132 5 d141 2 a142 8 extern ObjectId RelationNameCreateHeapRelation ARGS(( Name relationName, ArchiveMode archiveMode, AttributeNumber numberOfAttributes, TupleDescriptor tupleDescriptor )); d144 2 a145 8 extern ObjectId /* of the newly created relation */ amcreate ARGS(( char relationName[16], ArchiveMode archiveMode, u_int2 numberOfAttributes, Attribute attribute[] )); d151 2 a152 7 extern Relation RelationNameCreateTemporaryRelation ARGS(( Name relationName, AttributeNumber numberOfAttributes, TupleDescriptor tupleDescriptor )); d154 2 a155 7 extern Relation amcreatr ARGS(( char relationName[16], u_int2 numberOfAttributes, Attribute attribute[] )); a157 20 * RelationNameCreateVersionRelation -- * Creates a version relation. */ extern void RelationNameCreateVersionRelation ARGS(( Name originalRelationName, Name versionRelationName, long time /* AbsoluteTime XXX */ )); extern void amcreatv ARGS(( char originalRelationName[16], char versionRelationName[16], long time /* AbsoluteTime XXX */ )); /* d161 2 a162 5 extern void RelationNameDestroyHeapRelation ARGS(( Name relationName )); d164 2 a165 5 extern void amdestroy ARGS(( char relationName[16] )); a167 18 * RelationNameMergeRelations -- * Merges two version relations. */ extern void RelationNameMergeRelations ARGS(( Name oldRelationName, Name newRelationName )); extern void ammergev ARGS(( char oldRelationName[16], char newRelationName[16] )); /* d171 2 a172 5 extern Relation ObjectIdOpenHeapRelation ARGS(( ObjectId relationObjectId )); d174 2 a175 5 extern Relation amopen ARGS(( ObjectId relationObjectId )); d181 2 a182 5 extern Relation RelationNameOpenHeapRelation ARGS(( Name relationName )); d184 2 a185 5 extern Relation amopenr ARGS(( char relationName[16] )); d191 2 a192 5 extern void RelationCloseHeapRelation ARGS(( Relation relation )); d194 2 a195 5 extern void amclose ARGS(( Relation relation )); d201 2 a202 8 extern HeapTuple RelationGetHeapTupleByItemPointer ARGS(( Relation relation, TimeQual timeQual, ItemPointer heapItem, Buffer *bufferOutP )); d204 2 a205 8 extern HeapTuple amgetunique ARGS(( Relation relation, TimeQual timeQual, ItemPointer tid, Buffer *bufferOutP )); d211 2 a212 7 extern RuleLock RelationInsertHeapTuple ARGS(( Relation relation, HeapTuple heapTuple, double *offsetOutP )); d214 2 a215 7 extern RuleLock aminsert ARGS(( Relation relation, HeapTuple heapTuple, double *offsetOutP )); a216 7 extern RuleLock doinsert ARGS(( Relation relation, HeapTuple heapTuple )); d221 2 a222 6 extern RuleLock RelationDeleteHeapTuple ARGS(( Relation relation, ItemPointer heapItem )); d224 2 a225 6 extern RuleLock amdelete ARGS(( Relation relation, ItemPointer tid )); a227 11 * RelationPhysicallyDeleteHeapTuple -- * Physically deletes a heap tuple. */ extern void RelationPhysicallyDeleteHeapTuple ARGS(( Relation relation, ItemPointer heapItem )); /* d229 1 a229 1 * Replaces a heap tuple. d231 2 a232 8 extern RuleLock RelationReplaceHeapTuple ARGS(( Relation relation, ItemPointer heapItem, HeapTuple tuple, double *offsetOutP )); d234 2 a235 8 extern RuleLock amreplace ARGS(( Relation relation, ItemPointer tid, HeapTuple tuple, double *offsetOutP )); d241 2 a242 9 extern Datum HeapTupleGetAttributeValue ARGS(( HeapTuple tuple, Buffer buffer, AttributeNumber attributeNumber, TupleDescriptor tupleDescriptor, Boolean *attributeIsNullOutP )); a243 10 extern char * amgetattr ARGS(( HeapTuple tuple, Buffer buffer, AttributeNumber attributeNumber, Attribute attribute[], Boolean *attributeIsNullOutP )); d245 1 a245 1 * RelationGetHeapScan -- d248 2 a249 9 extern HeapScanDesc RelationBeginHeapScan ARGS(( Relation relation, Boolean startScanAtEnd, TimeQual timeQual, uint16 numberOfKeys, ScanKey key )); d251 2 a252 9 extern HeapScanDesc ambeginscan ARGS(( Relation relation, Boolean startScanAtEnd, TimeQual timeQual, uint16 numberOfKeys, ScanKey key )); d258 2 a259 7 extern void HeapScanRestart ARGS(( HeapScanDesc scan, bool restartScanAtEnd, ScanKey key )); d261 2 a262 7 extern void amrescan ARGS(( HeapScanDesc scan, bool restartScanAtEnd, ScanKey key )); d268 2 a269 5 extern void HeapScanEnd ARGS(( HeapScanDesc scan )); d271 2 a272 5 extern void amendscan ARGS(( HeapScanDesc scan )); d278 2 a279 5 extern void HeapScanMarkPosition ARGS(( HeapScanDesc scan )); d281 2 a282 5 extern void ammarkpos ARGS(( HeapScanDesc scan )); d288 2 a289 5 extern void HeapScanRestorePosition ARGS(( HeapScanDesc scan )); d291 2 a292 5 extern void amrestrpos ARGS(( HeapScanDesc scan )); d298 2 a299 7 extern HeapTuple HeapScanGetNextTuple ARGS(( HeapScanDesc scan, Boolean backwards, Buffer *bufferOutP )); d301 2 a302 7 extern HeapTuple amgetnext ARGS(( HeapScanDesc scan, Boolean backwards, Buffer *bufferOutP )); d305 1 a305 2 * amfreetuple -- * General access method free tuple routine. d307 20 a326 5 extern amfreetuple ARGS(( void /* this needs more thought */ )); @ 1.10 log @eliminated less significant .h files @ text @d12 1 a12 1 #define HEAPAM_H "$Header: RCS/heapam.h,v 1.9 90/08/17 08:50:44 cimarron Exp Locker: cimarron $" d39 14 a52 13 int global_amopen; int global_amopenr; int global_amclose; int global_ambeginscan; int global_amrescan; int global_amendscan; int global_amgetnext; int global_amgetunique; int global_aminsert; int global_amdelete; int global_amreplace; int global_ammarkpos; int global_amrestrpos; d54 2 d64 14 a77 13 int local_amopen; int local_amopenr; int local_amclose; int local_ambeginscan; int local_amrescan; int local_amendscan; int local_amgetnext; int local_amgetunique; int local_aminsert; int local_amdelete; int local_amreplace; int local_ammarkpos; int local_amrestrpos; d79 2 d96 27 @ 1.9 log @added pathnames to #include statements @ text @d12 1 a12 1 #define HEAPAM_H "$Header: RCS/heapam.h,v 1.8 90/05/25 14:06:44 mao Version_2 Locker: cimarron $" a26 2 #include "tmp/datum.h" #include "tmp/name.h" @ 1.8 log @add doinsert(), new routine that does half the work of aminsert(). was added to support tuple archival (don't want to stomp on tmax, xmax fields). @ text @d12 1 a12 1 #define HEAPAM_H "$Header: RCS/heapam.h,v 1.7 90/03/31 18:56:53 cimarron Exp Locker: mao $" d16 1 a16 3 #ifndef C_H #include "c.h" #endif d18 7 a24 2 #include "att.h" /* XXX */ #include "skey.h" d26 4 a29 30 #ifndef ATTNUM_H # include "attnum.h" #endif #ifndef DATUM_H # include "datum.h" #endif #ifndef HTUP_H # include "htup.h" #endif #ifndef NAME_H # include "name.h" #endif #ifndef OID_H # include "oid.h" #endif #ifndef REL_H # include "rel.h" #endif #ifndef RELSCAN_H # include "relscan.h" #endif #ifndef RLOCK_H # include "rlock.h" #endif #ifndef TQUAL_H # include "tqual.h" #endif #ifndef TUPDESC_H # include "tupdesc.h" #endif @ 1.7 log @added heap access statistics definitions @ text @d12 1 a12 1 #define HEAPAM_H "$Header: RCS/heapam.h,v 1.6 89/09/29 18:51:21 hirohama Exp $" d300 7 @ 1.6 log @"trange" -> "tqual" @ text @d12 1 a12 1 #define HEAPAM_H "$Header: RCS/heapam.h,v 1.5 89/09/05 17:06:33 mao C_Demo_1 Locker: hirohama $" d14 2 d53 62 @ 1.5 log @Working version of C-only demo @ text @a3 3 * * Identification: * $Header: heapam.h,v 1.4 89/08/10 17:27:10 hirohama Exp $ d9 9 a18 9 #include "attnum.h" #include "datum.h" #include "htup.h" #include "name.h" #include "oid.h" #include "rel.h" #include "relscan.h" #include "rlock.h" a19 2 #include "trange.h" #include "tupdesc.h" d21 31 d161 1 a161 1 OID relationObjectId d204 1 a204 1 TimeRange range, d213 1 a213 1 TimeRange range, d322 1 a322 1 TimeRange timer, d332 1 a332 1 TimeRange timer, @ 1.4 log @...CreateHeapRelation now returns relation id @ text @d6 1 a6 1 * $Header: heapam.h,v 1.3 89/08/09 18:13:45 hirohama Locked $ @ 1.3 log @"retrieve(x=1)" @ text @d6 1 a6 1 * $Header: /usr6/postgres/cimarron/postgres3/src/lib/H/RCS/heapam.h,v 1.2 89/03/22 17:32:59 muir Stab $ d9 1 a9 1 #ifndef HeapAMIncluded /* Include this file only once */ d28 1 a28 1 * Creates a cataloged heap relation. d31 1 a31 1 void @ 1.2 log @copyright removal @ text @d6 1 a6 1 * $Header: /usr6/postgres/muir/postgres/src/lib/H/RCS/heapam.h,v 1.1 89/01/17 05:54:08 cimarron Exp $ d292 1 a292 1 HeapScan d302 1 a302 1 HeapScan d318 1 a318 1 HeapScan scan, d326 1 a326 1 HeapScan scan, d338 1 a338 1 HeapScan scan d344 1 a344 1 HeapScan scan d354 1 a354 1 HeapScan scan d360 1 a360 1 HeapScan scan d370 1 a370 1 HeapScan scan d376 1 a376 1 HeapScan scan d386 1 a386 1 HeapScan scan, d394 1 a394 1 HeapScan scan, @ 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: heapam.h,v 1.1 88/11/11 16:37:06 postgres Exp $ @