head	1.20;
access;
symbols
	release_4_2:1.20
	aix_ok:1.17
	Version_2_1:1.6;
locks; strict;
comment	@ * @;


1.20
date	94.02.15.06.10.39;	author aoki;	state Exp;
branches;
next	1.19;

1.19
date	94.02.07.11.30.03;	author aoki;	state Exp;
branches;
next	1.18;

1.18
date	93.11.03.08.24.31;	author aoki;	state Exp;
branches;
next	1.17;

1.17
date	93.01.23.00.58.17;	author mao;	state Exp;
branches;
next	1.16;

1.16
date	93.01.05.02.31.00;	author aoki;	state Exp;
branches;
next	1.15;

1.15
date	92.04.13.18.30.47;	author mer;	state Exp;
branches;
next	1.14;

1.14
date	91.11.18.20.17.41;	author clarsen;	state Exp;
branches;
next	1.13;

1.13
date	91.11.08.15.40.53;	author kemnitz;	state Exp;
branches;
next	1.12;

1.12
date	91.10.29.20.27.55;	author mer;	state Exp;
branches;
next	1.11;

1.11
date	91.10.18.08.17.54;	author mer;	state Exp;
branches;
next	1.10;

1.10
date	91.09.29.00.23.38;	author mer;	state Exp;
branches;
next	1.9;

1.9
date	91.09.13.17.32.54;	author mer;	state Exp;
branches;
next	1.8;

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

1.7
date	91.04.28.09.17.08;	author cimarron;	state Exp;
branches;
next	1.6;

1.6
date	91.03.01.00.02.45;	author mao;	state Exp;
branches;
next	1.5;

1.5
date	91.02.28.18.01.27;	author mao;	state Exp;
branches;
next	1.4;

1.4
date	91.02.24.09.02.13;	author mao;	state Exp;
branches;
next	1.3;

1.3
date	91.02.19.13.57.33;	author mao;	state Exp;
branches;
next	1.2;

1.2
date	91.02.06.18.04.11;	author cimarron;	state Exp;
branches;
next	1.1;

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


desc
@reorganization of access method code 1/28/91 -cim
@


1.20
log
@uninit var (looks like it's not looked at by lower routines)
@
text
@/* ----------------------------------------------------------------
 *   FILE
 *	indexam.c
 *	
 *   DESCRIPTION
 *	general index access method routines
 *
 *   INTERFACE ROUTINES
 *	index_open 	- open an index relation by relationId
 *	index_openr 	- open a index relation by name
 *	index_close 	- close a index relation
 *	index_beginscan - start a scan of an index
 *	index_rescan  	- restart a scan of an index
 *	index_endscan 	- end a scan
 *	index_insert 	- insert an index tuple into a relation
 *	index_delete 	- delete an item from an index relation
 *	index_markpos  	- mark a scan position
 *	index_restrpos  - restore a scan position
 *	index_getnext 	- get the next tuple from a scan
 * **	index_fetch	- retrieve tuple with tid
 * **	index_replace	- replace a tuple
 * **	index_getattr	- get an attribute from an index tuple
 *	index_getprocid - get a support procedure id from the rel tuple
 *	
 *	IndexScanIsValid - check index scan
 *
 *   NOTES
 *	This file contains the index_ routines which used
 *	to be a scattered collection of stuff in access/genam.
 *
 *	The ** routines: index_fetch, index_replace, and index_getattr
 *	have not yet been implemented.  They may not be needed.
 *
 * old comments
 * 	Scans are implemented as follows:
 *
 * 	`0' represents an invalid item pointer.
 * 	`-' represents an unknown item pointer.
 * 	`X' represents a known item pointers.
 * 	`+' represents known or invalid item pointers.
 * 	`*' represents any item pointers.
 *
 * 	State is represented by a triple of these symbols in the order of
 * 	previous, current, next.  Note that the case of reverse scans works
 * 	identically.
 *
 *		State	Result
 * 	(1)	+ + -	+ 0 0		(if the next item pointer is invalid)
 * 	(2)		+ X -		(otherwise)
 * 	(3)	* 0 0	* 0 0		(no change)
 * 	(4)	+ X 0	X 0 0		(shift)
 * 	(5)	* + X	+ X -		(shift, add unknown)
 *
 * 	All other states cannot occur.
 *
 * 	Note: It would be possible to cache the status of the previous and
 *	      next item pointer using the flags.
 *
 *  IDENTIFICATION
 *	$Header: /import/faerie/faerie/aoki/postgres/src/backend/access/index/RCS/indexam.c,v 1.19 1994/02/07 11:30:03 aoki Exp aoki $
 * ----------------------------------------------------------------
 */

#include "tmp/postgres.h"

RcsId("$Header: /import/faerie/faerie/aoki/postgres/src/backend/access/index/RCS/indexam.c,v 1.19 1994/02/07 11:30:03 aoki Exp aoki $");

#include "access/attnum.h"
#include "access/genam.h"
#include "access/heapam.h"
#include "access/itup.h"
#include "access/relscan.h"
#include "access/sdir.h"
#include "access/skey.h"
#include "access/funcindex.h"

#include "storage/form.h"
#include "utils/log.h"
#include "utils/palloc.h"
#include "utils/rel.h"
#include "utils/relcache.h"

#include "catalog/catname.h"
#include "catalog/pg_attribute.h"
#include "catalog/pg_index.h"
#include "catalog/pg_proc.h"

#include "lib/index.h"

#include "fmgr.h"

/* ----------------
 *   undefine macros we aren't going to use that would otherwise
 *   get in our way..  delete is defined in c.h and the am's are
 *   defined in heapam.h
 * ----------------
 */
#undef delete
#undef aminsert
#undef amdelete
#undef ambeginscan
#undef amrescan
#undef amendscan
#undef ammarkpos
#undef amrestrpos
#undef amgettuple

/* ----------------------------------------------------------------
 *		    macros used in index_ routines
 * ----------------------------------------------------------------
 */
#define RELATION_CHECKS \
    Assert(RelationIsValid(relation)); \
    Assert(FormIsValid((Form) relation->rd_am))

#define SCAN_CHECKS \
    Assert(IndexScanIsValid(scan)); \
    Assert(RelationIsValid(scan->relation)); \
    Assert(FormIsValid((Form) scan->relation->rd_am))

#define GET_REL_PROCEDURE(x,y) \
    CppConcat(procedure = relation->rd_am->,y); \
    if (! RegProcedureIsValid(procedure)) \
        elog(WARN, "index_%s: invalid %s regproc", \
	     CppAsString(x), CppAsString(y))

#define GET_SCAN_PROCEDURE(x,y) \
    CppConcat(procedure = scan->relation->rd_am->,y); \
    if (! RegProcedureIsValid(procedure)) \
        elog(WARN, "index_%s: invalid %s regproc", \
	     CppAsString(x), CppAsString(y))


/* ----------------------------------------------------------------
 *		   index_ interface functions
 * ----------------------------------------------------------------
 */
/* ----------------
 *	index_open - open an index relation by relationId
 *
 *	presently the relcache routines do all the work we need
 *	to open/close index relations.
 * ----------------
 */
Relation
index_open(relationId)
    ObjectId	relationId;
{
    return (Relation)
	RelationIdGetRelation(relationId);
}

/* ----------------
 *	index_openr - open a index relation by name
 *
 *	presently the relcache routines do all the work we need
 *	to open/close index relations.
 * ----------------
 */
Relation
index_openr(relationName)
    Name relationName;
{
    return (Relation)
	RelationNameGetRelation(relationName);
}

/* ----------------
 *	index_close - close a index relation
 *
 *	presently the relcache routines do all the work we need
 *	to open/close index relations.
 * ----------------
 */
void
index_close(relation)
    Relation relation;
{
    (void) RelationClose(relation);
}

/* ----------------
 *	index_insert - insert an index tuple into a relation
 * ----------------
 */
GeneralInsertIndexResult
index_insert(relation, indexTuple, offsetOutP)
    Relation	relation;
    IndexTuple	indexTuple;
    double	*offsetOutP;
{
    RegProcedure		procedure;
    InsertIndexResult		specificResult;
    GeneralInsertIndexResult	returnResult;

    RELATION_CHECKS;
    GET_REL_PROCEDURE(insert,aminsert);
    
    /* ----------------
     *	have the am's insert proc do all the work.  
     * ----------------
     */
    specificResult = (InsertIndexResult)
	fmgr(procedure, relation, indexTuple, NULL);

    /* ----------------
     *	the insert proc is supposed to return a "specific result" and
     *  this routine has to return a "general result" so after we get
     *  something back from the insert proc, we allocate a
     *  "general result" and copy some crap between the two.
     *
     *  As far as I'm concerned all this result shit is needlessly c
     *  omplicated and should be eliminated.  -cim 1/19/91
     *
     *  mao concurs.  regardless of how we feel here, however, it is
     *  important to free memory we don't intend to return to anyone.
     *  2/28/91
     * ----------------
     */
    if (specificResult != (InsertIndexResult) NULL) {
	returnResult = (GeneralInsertIndexResult) palloc(sizeof *returnResult);
	returnResult->pointerData = specificResult->pointerData;

	if (PointerIsValid(offsetOutP))
	    *offsetOutP = specificResult->offset;
	
	pfree(specificResult);
    } else {
	returnResult = (GeneralInsertIndexResult) NULL;
    }

    return (returnResult);
}

/* ----------------
 *	index_delete - delete an item from an index relation
 * ----------------
 */
void
index_delete(relation, indexItem)
    Relation	relation;
    ItemPointer	indexItem;
{
    RegProcedure	procedure;
    
    RELATION_CHECKS;
    GET_REL_PROCEDURE(delete,amdelete);
    
    (void) fmgr(procedure, relation, indexItem);    
}

/* ----------------
 *	index_beginscan - start a scan of an index
 * ----------------
 */
IndexScanDesc
index_beginscan(relation, scanFromEnd, numberOfKeys, key)
    Relation	relation;
    Boolean	scanFromEnd;
    uint16	numberOfKeys;
    ScanKey	key;
{
    IndexScanDesc	scandesc;
    RegProcedure	procedure;
    
    RELATION_CHECKS;
    GET_REL_PROCEDURE(beginscan,ambeginscan);
    
    RelationSetRIntentLock(relation);

    scandesc = (IndexScanDesc)
	fmgr(procedure, relation, scanFromEnd, numberOfKeys, key);
    
    return scandesc;
}

/* ----------------
 *	index_rescan  - restart a scan of an index
 * ----------------
 */
void
index_rescan(scan, scanFromEnd, key)
    IndexScanDesc	scan;
    bool		scanFromEnd;
    ScanKey		key;
{
    RegProcedure	procedure;
    
    SCAN_CHECKS;
    GET_SCAN_PROCEDURE(rescan,amrescan);

    (void) fmgr(procedure, scan, scanFromEnd, key);
}

/* ----------------
 *	index_endscan - end a scan
 * ----------------
 */
void
index_endscan(scan)
    IndexScanDesc	scan;
{
    RegProcedure	procedure;
    
    SCAN_CHECKS;
    GET_SCAN_PROCEDURE(endscan,amendscan);

    (void) fmgr(procedure, scan);

    RelationUnsetRIntentLock(scan->relation);
}

/* ----------------
 *	index_markpos  - mark a scan position
 * ----------------
 */
void
index_markpos(scan)
    IndexScanDesc	scan;
{
    RegProcedure	procedure;
    
    SCAN_CHECKS;
    GET_SCAN_PROCEDURE(markpos,ammarkpos);

    (void) fmgr(procedure, scan);
}

/* ----------------
 *	index_restrpos  - restore a scan position
 * ----------------
 */
void
index_restrpos(scan)
    IndexScanDesc	scan;
{
    RegProcedure	procedure;
    
    SCAN_CHECKS;
    GET_SCAN_PROCEDURE(restrpos,amrestrpos);

    (void) fmgr(procedure, scan);
}

/* ----------------
 *	index_getnext - get the next tuple from a scan
 *
 *  	A RetrieveIndexResult is a index tuple/heap tuple pair
 * ----------------
 */
RetrieveIndexResult
index_getnext(scan, direction)
    IndexScanDesc	scan;
    ScanDirection	direction;
{
    RegProcedure		procedure;
    RetrieveIndexResult		result;

    SCAN_CHECKS;
    GET_SCAN_PROCEDURE(getnext,amgettuple);

    /* ----------------
     *	have the am's gettuple proc do all the work.  
     * ----------------
     */
    result = (RetrieveIndexResult)
	fmgr(procedure, scan, direction);

    if (! RetrieveIndexResultIsValid(result))
	return NULL;
    
    return result;
}
/* ----------------
 *	index_getprocid
 *
 *	Some indexed access methods may require support routines that are
 *	not in the operator class/operator model imposed by pg_am.  These
 *	access methods may store the OIDs of registered procedures they
 *	need in pg_amproc.  These registered procedure OIDs are ordered in
 *	a way that makes sense to the access method, and used only by the
 *	access method.  The general index code doesn't know anything about
 *	the routines involved; it just builds an ordered list of them for
 *	each attribute on which an index is defined.
 *
 *	This routine returns the requested procedure OID for a particular
 *	indexed attribute.
 * ----------------
 */

RegProcedure
index_getprocid(irel, attnum, procnum)
    Relation irel;
    AttributeNumber attnum;
    uint16 procnum;
{
    RegProcedure *loc;
    AttributeNumber natts;

    natts = irel->rd_rel->relnatts;

    loc = *((RegProcedure **)
       (((char *) &(irel->rd_att.data[natts])) + sizeof(IndexStrategy)));

    Assert(loc != NULL);

    return (loc[(natts * (procnum - 1)) + (attnum - 1)]);
}

/* ----------------
 *	InsertIndexTuple
 * ----------------
 */
void
InsertIndexTuple(heapRelation, indexRelation, numberOfAttributes, 
		 attributeNumber, heapTuple, 
		 indexStrategy, parameterCount, parameter)
    Relation		heapRelation;
    Relation		indexRelation;
    AttributeNumber	numberOfAttributes;
    AttributeNumber	attributeNumber[];
    HeapTuple          	heapTuple;
    IndexStrategy	indexStrategy;
    uint16		parameterCount;
    Datum		parameter[];
{
    HeapScanDesc	scan;
    /* XXX 'buffer' previously uninit?  ignored in lower code anyway.. */
    Buffer		buffer = InvalidBuffer;
    AttributeNumber	attributeIndex;
    IndexTuple		indexTuple;
    TupleDescriptor	heapDescriptor;
    TupleDescriptor	indexDescriptor;
    Datum		*datum;
    Boolean		*nullv;

    char		*dom[2];
    extern		HasCached;
    extern char		CachedClass[];
    extern		fillCached();
    GeneralInsertIndexResult	insertResult;

    /* more & better checking is needed */
    Assert(ObjectIdIsValid(indexRelation->rd_rel->relam));	/* XXX */

    datum = (Datum *)   palloc(numberOfAttributes * sizeof *datum);
    nullv =  (Boolean *) palloc(numberOfAttributes * sizeof *nullv);
    
    heapDescriptor =  RelationGetTupleDescriptor(heapRelation);
    indexDescriptor = RelationGetTupleDescriptor(indexRelation);

    Assert(HeapTupleIsValid(heapTuple));
    for (attributeIndex = 1; attributeIndex <= numberOfAttributes;
	 attributeIndex += 1) {
	  
	AttributeOffset	attributeOffset;
	Boolean		attributeIsNull;
	  
	attributeOffset = AttributeNumberGetAttributeOffset(attributeIndex);

	datum[attributeOffset] =
	    PointerGetDatum( heap_getattr(heapTuple, buffer,
					  attributeNumber[attributeOffset],
					  heapDescriptor, &attributeIsNull) );
	
	  nullv[attributeOffset] = (attributeIsNull) ? 'n' : ' ';
    }

    indexTuple = (IndexTuple)
	index_formtuple(numberOfAttributes,
			indexDescriptor,
			datum,
			nullv);

    indexTuple->t_tid = heapTuple->t_ctid;

    insertResult = index_insert(indexRelation, indexTuple, (double *) 0);

    if (insertResult != (GeneralInsertIndexResult) NULL)
	pfree (insertResult);
	
    pfree(indexTuple);
    pfree(nullv);
    pfree(datum);
}

/* ----------------
 *	GetHeapTuple
 * ----------------
 */
HeapTuple
GetHeapTuple(result, heaprel, buffer)
    GeneralRetrieveIndexResult      result;
    Relation                        heaprel;
    Buffer                          buffer;
{
    ItemPointer     pointer;
    HeapTuple       tuple;

    Assert(GeneralRetrieveIndexResultIsValid(result));

    pointer = GeneralRetrieveIndexResultGetHeapItemPointer(result);

    if (! ItemPointerIsValid(pointer))
	return NULL;

    tuple = heap_fetch(heaprel, NowTimeQual, pointer, &buffer);

    if (! HeapTupleIsValid(tuple)) 
	return(NULL);
    else 
	return(tuple);
}

Datum
GetIndexValue(tuple, hTupDesc, attOff, attrNums, fInfo, attNull, buffer)
	HeapTuple tuple;
	TupleDescriptor hTupDesc;
	AttributeOffset attOff;
	AttributeNumber attrNums[];
	FuncIndexInfo *fInfo;
	Boolean *attNull;
	Buffer buffer;
{
    Datum returnVal;
    Boolean	isNull;

    if (PointerIsValid(fInfo) && FIgetProcOid(fInfo) != InvalidObjectId)
    {
	int i;
	Datum *attData = (Datum *)palloc(FIgetnArgs(fInfo)*sizeof(Datum));

	for (i = 0; i < FIgetnArgs(fInfo); i++)
	{
	    attData[i] = (Datum) heap_getattr(tuple, buffer, attrNums[i], 
					      hTupDesc, attNull);
	}
	returnVal = (Datum)fmgr_array_args(FIgetProcOid(fInfo),
					   FIgetnArgs(fInfo),
					   (char **) attData,
					   &isNull);
	pfree(attData);
	*attNull = FALSE;
    }
    else
    {
	returnVal = (Datum) heap_getattr(tuple, buffer, attrNums[attOff], 
					 hTupDesc, attNull);
    }
    return returnVal;
}
@


1.19
log
@proto fixes
@
text
@d60 1
a60 1
 *	$Header: /import/faerie/faerie/aoki/postgres/src/backend/access/index/RCS/indexam.c,v 1.18 1993/11/03 08:24:31 aoki Exp aoki $
d66 1
a66 1
RcsId("$Header: /import/faerie/faerie/aoki/postgres/src/backend/access/index/RCS/indexam.c,v 1.18 1993/11/03 08:24:31 aoki Exp aoki $");
d428 2
a429 1
    Buffer		buffer;
@


1.18
log
@fix broken prs2 protos
remove rules/rlock.h, access/xcxt.h, access/newam.h (dead headers
  with residual dependencies)
@
text
@d60 1
a60 1
 *	$Header: /faerie/aoki/postgres/src/backend/access/index/RCS/indexam.c,v 1.17 1993/01/23 00:58:17 mao Exp aoki $
d66 1
a66 1
RcsId("$Header: /faerie/aoki/postgres/src/backend/access/index/RCS/indexam.c,v 1.17 1993/01/23 00:58:17 mao Exp aoki $");
d79 1
d81 1
d90 2
d539 1
a539 1
					   attData,
@


1.17
log
@don't pfree null pointers
@
text
@d60 1
a60 1
 *	$Header: /private/src/postgres/src/backend/access/index/RCS/indexam.c,v 1.16 1993/01/05 02:31:00 aoki Exp mao $
d66 2
a71 1
#include "access/newam.h"
d86 1
a86 1
RcsId("$Header: /private/src/postgres/src/backend/access/index/RCS/indexam.c,v 1.16 1993/01/05 02:31:00 aoki Exp mao $");
@


1.16
log
@fmgr call was missing an argument..
@
text
@d60 1
a60 1
 *	$Header: /home2/aoki/postgres/src/backend/access/index/RCS/indexam.c,v 1.15 1992/04/13 18:30:47 mer Exp aoki $
d85 1
a85 1
RcsId("$Header: /home2/aoki/postgres/src/backend/access/index/RCS/indexam.c,v 1.15 1992/04/13 18:30:47 mer Exp aoki $");
d215 3
a217 2
    returnResult = (GeneralInsertIndexResult) palloc(sizeof *returnResult);
    returnResult->pointerData = specificResult->pointerData;
d219 8
a226 4
    if (PointerIsValid(offsetOutP))
	*offsetOutP = specificResult->offset;
    
    pfree(specificResult);
d472 3
@


1.15
log
@release intent locks *after* releasing page locks in scan
@
text
@d60 1
a60 1
 *	$Header: /users/mer/pg/src/access/index/RCS/indexam.c,v 1.14 1991/11/18 20:17:41 clarsen Exp mer $
d85 1
a85 1
RcsId("$Header: /users/mer/pg/src/access/index/RCS/indexam.c,v 1.14 1991/11/18 20:17:41 clarsen Exp mer $");
d512 1
d526 2
a527 1
					   attData);
@


1.14
log
@prototypes
@
text
@d60 1
a60 1
 *	$Header: RCS/indexam.c,v 1.13 91/11/08 15:40:53 kemnitz Exp Locker: clarsen $
d85 1
a85 1
RcsId("$Header: RCS/indexam.c,v 1.13 91/11/08 15:40:53 kemnitz Exp Locker: clarsen $");
d298 2
a300 2

    (void) fmgr(procedure, scan);
@


1.13
log
@fixed prototypes
@
text
@d60 1
a60 1
 *	$Header: RCS/indexam.c,v 1.12 91/10/29 20:27:55 mer Exp $
d85 1
a85 1
RcsId("$Header: RCS/indexam.c,v 1.12 91/10/29 20:27:55 mer Exp $");
d424 1
a424 1
    Boolean		*null;
d436 1
a436 1
    null =  (Boolean *) palloc(numberOfAttributes * sizeof *null);
d455 1
a455 1
	  null[attributeOffset] = (attributeIsNull) ? 'n' : ' ';
d462 1
a462 1
			null);
d469 1
a469 1
    pfree(null);
@


1.12
log
@must now set read intent locks before index scans and remove them in endscan
@
text
@d60 1
a60 1
 *	$Header: /users/mer/postgres/src/access/index/RCS/indexam.c,v 1.11 1991/10/18 08:17:54 mer Exp mer $
d85 1
a85 1
RcsId("$Header: /users/mer/postgres/src/access/index/RCS/indexam.c,v 1.11 1991/10/18 08:17:54 mer Exp mer $");
d466 1
a466 4
    insertResult = index_insert(indexRelation,
				indexTuple, 
				(Pointer)NULL,
				(double *)NULL);
@


1.11
log
@minor bug fixes
@
text
@d60 1
a60 1
 *	$Header: /users/mer/postgres/src/access/index/RCS/indexam.c,v 1.10 1991/09/29 00:23:38 mer Exp mer $
d85 1
a85 1
RcsId("$Header: /users/mer/postgres/src/access/index/RCS/indexam.c,v 1.10 1991/09/29 00:23:38 mer Exp mer $");
d259 2
d297 2
@


1.10
log
@functional indice change
@
text
@d60 1
a60 1
 *	$Header: /users/mer/postgres/src/access/index/RCS/indexam.c,v 1.9 1991/09/13 17:32:54 mer Exp mer $
d85 1
a85 1
RcsId("$Header: /users/mer/postgres/src/access/index/RCS/indexam.c,v 1.9 1991/09/13 17:32:54 mer Exp mer $");
d512 1
a512 1
    if (PointerIsValid(fInfo))
d526 1
a526 4
	if (returnVal == (Datum)NULL)
	    *attNull = TRUE;
	else
	    *attNull = FALSE;
@


1.9
log
@fix for defining index with multi-attributes.
@
text
@d60 1
a60 1
 *	$Header: /users/mer/postgres/src/access/index/RCS/indexam.c,v 1.8 1991/05/01 02:49:27 cimarron Exp mer $
d74 1
d85 1
a85 1
RcsId("$Header: /users/mer/postgres/src/access/index/RCS/indexam.c,v 1.8 1991/05/01 02:49:27 cimarron Exp mer $");
d498 39
@


1.8
log
@round II of converting simple functions to macros + code cleaning in general
@
text
@d60 1
a60 1
 *	$Header: RCS/indexam.c,v 1.7 91/04/28 09:17:08 cimarron Exp Locker: cimarron $
d84 1
a84 1
RcsId("$Header: RCS/indexam.c,v 1.7 91/04/28 09:17:08 cimarron Exp Locker: cimarron $");
d392 1
a392 1
    return (loc[(natts * (attnum - 1)) + (procnum - 1)]);
@


1.7
log
@Converted IsValid code into macros and added an improved NodeIsType scheme
@
text
@d60 1
a60 1
 *	$Header: RCS/indexam.c,v 1.6 91/03/01 00:02:45 mao Exp Locker: cimarron $
d84 1
a84 1
RcsId("$Header: RCS/indexam.c,v 1.6 91/03/01 00:02:45 mao Exp Locker: cimarron $");
d87 3
a89 2
 *   delete is used as the argument to a macro in this file so
 *   we don't use the "delete" macro defined in c.h
d93 8
@


1.6
log
@plug memory leak
@
text
@d60 1
a60 1
 *	$Header: RCS/indexam.c,v 1.5 91/02/28 18:01:27 mao Exp Locker: mao $
d84 1
a84 1
RcsId("$Header: RCS/indexam.c,v 1.5 91/02/28 18:01:27 mao Exp Locker: mao $");
a91 11

/* ----------------
 *	IndexScanIsValid
 * ----------------
 */
bool
IndexScanIsValid(scan)
    IndexScanDesc	scan;
{
    return ((bool) PointerIsValid(scan));
}
@


1.5
log
@patch some memory leaks
@
text
@d60 1
a60 1
 *	$Header: RCS/indexam.c,v 1.4 91/02/24 09:02:13 mao Exp Locker: mao $
d84 1
a84 1
RcsId("$Header: RCS/indexam.c,v 1.4 91/02/24 09:02:13 mao Exp Locker: mao $");
d222 1
@


1.4
log
@fix pg_amproc support -- bad array index
@
text
@d60 1
a60 1
 *	$Header: RCS/indexam.c,v 1.3 91/02/19 13:57:33 mao Exp Locker: mao $
d84 1
a84 1
RcsId("$Header: RCS/indexam.c,v 1.3 91/02/19 13:57:33 mao Exp Locker: mao $");
d210 4
d218 1
a218 1
    
@


1.3
log
@new rtree code installed
@
text
@d60 1
a60 1
 *	$Header: RCS/indexam.c,v 1.2 91/02/06 18:04:11 cimarron Exp Locker: mao $
d84 1
a84 1
RcsId("$Header: RCS/indexam.c,v 1.2 91/02/06 18:04:11 cimarron Exp Locker: mao $");
d384 2
a385 2
    loc = (RegProcedure *)
       (((char *) &(irel->rd_att.data[natts])) + sizeof(IndexStrategy));
@


1.2
log
@removed references to old interface routines
@
text
@d23 1
d60 1
a60 1
 *	$Header: RCS/indexam.c,v 1.1 91/01/29 15:20:15 cimarron Exp Locker: cimarron $
d84 1
a84 1
RcsId("$Header: RCS/indexam.c,v 1.1 91/01/29 15:20:15 cimarron Exp Locker: cimarron $");
d355 35
@


1.1
log
@Initial revision
@
text
@d59 1
a59 1
 *	$Header$
d83 1
a83 1
#include "internal.h"
d85 5
a89 2
RcsId("$Header$");

d422 4
a425 4
    insertResult = RelationInsertIndexTuple(indexRelation,
					    indexTuple, 
					    (Pointer)NULL,
					    (double *)NULL);
d452 1
a452 4
    tuple = RelationGetHeapTupleByItemPointer(heaprel,
					      NowTimeQual,
					      pointer,
					      &buffer);
@
