* POSTGRES relation scan descriptor definitions.
*
*
- * Portions Copyright (c) 1996-2002, PostgreSQL Global Development Group
+ * Portions Copyright (c) 1996-2004, PostgreSQL Global Development Group
* Portions Copyright (c) 1994, Regents of the University of California
*
- * $Id: relscan.h,v 1.28 2002/06/20 20:29:43 momjian Exp $
+ * $PostgreSQL: pgsql/src/include/access/relscan.h,v 1.36 2004/08/29 04:13:03 momjian Exp $
*
*-------------------------------------------------------------------------
*/
#ifndef RELSCAN_H
#define RELSCAN_H
+#include "access/skey.h"
#include "utils/tqual.h"
Snapshot rs_snapshot; /* snapshot to see */
int rs_nkeys; /* number of scan keys */
ScanKey rs_key; /* array of scan key descriptors */
+ BlockNumber rs_nblocks; /* number of blocks to scan */
/* scan current state */
HeapTupleData rs_ctup; /* current tuple in scan, if any */
void *opaque; /* access-method-specific info */
ItemPointerData currentItemData; /* current index pointer */
ItemPointerData currentMarkData; /* marked position, if any */
+
/*
- * xs_ctup/xs_cbuf are valid after a successful index_getnext.
- * After index_getnext_indexitem, xs_ctup.t_self contains the
- * heap tuple TID from the index entry, but its other fields are
- * not valid.
+ * xs_ctup/xs_cbuf are valid after a successful index_getnext. After
+ * index_getnext_indexitem, xs_ctup.t_self contains the heap tuple TID
+ * from the index entry, but its other fields are not valid.
*/
HeapTupleData xs_ctup; /* current heap tuple, if any */
Buffer xs_cbuf; /* current heap buffer in scan, if any */
FmgrInfo fn_getnext; /* cached lookup info for AM's getnext fn */
+ /*
+ * If keys_are_unique and got_tuple are both true, we stop calling the
+ * index AM; it is then necessary for index_getnext to keep track of
+ * the logical scan position for itself. It does that using
+ * unique_tuple_pos: -1 = before row, 0 = on row, +1 = after row.
+ */
+ int unique_tuple_pos; /* logical position */
+ int unique_tuple_mark; /* logical marked position */
+
PgStat_Info xs_pgstat_info; /* statistics collector hook */
} IndexScanDescData;