]> granicus.if.org Git - postgresql/blobdiff - src/include/access/relscan.h
Update copyright to 2004.
[postgresql] / src / include / access / relscan.h
index 231d341749cabb2d2fa0d6b545e1133217ee1081..057773642e1e9a6e78eab336182d4585a805cff1 100644 (file)
@@ -4,16 +4,17 @@
  *       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"
 
 
@@ -24,6 +25,7 @@ typedef struct HeapScanDescData
        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 */
@@ -58,11 +60,11 @@ typedef struct IndexScanDescData
        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 */
@@ -70,6 +72,15 @@ typedef struct IndexScanDescData
 
        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;