]> granicus.if.org Git - postgresql/blob - src/include/access/relscan.h
Remove cvs keywords from all files.
[postgresql] / src / include / access / relscan.h
1 /*-------------------------------------------------------------------------
2  *
3  * relscan.h
4  *        POSTGRES relation scan descriptor definitions.
5  *
6  *
7  * Portions Copyright (c) 1996-2010, PostgreSQL Global Development Group
8  * Portions Copyright (c) 1994, Regents of the University of California
9  *
10  * src/include/access/relscan.h
11  *
12  *-------------------------------------------------------------------------
13  */
14 #ifndef RELSCAN_H
15 #define RELSCAN_H
16
17 #include "access/genam.h"
18 #include "access/heapam.h"
19
20
21 typedef struct HeapScanDescData
22 {
23         /* scan parameters */
24         Relation        rs_rd;                  /* heap relation descriptor */
25         Snapshot        rs_snapshot;    /* snapshot to see */
26         int                     rs_nkeys;               /* number of scan keys */
27         ScanKey         rs_key;                 /* array of scan key descriptors */
28         bool            rs_bitmapscan;  /* true if this is really a bitmap scan */
29         bool            rs_pageatatime; /* verify visibility page-at-a-time? */
30         bool            rs_allow_strat; /* allow or disallow use of access strategy */
31         bool            rs_allow_sync;  /* allow or disallow use of syncscan */
32
33         /* state set up at initscan time */
34         BlockNumber rs_nblocks;         /* number of blocks to scan */
35         BlockNumber rs_startblock;      /* block # to start at */
36         BufferAccessStrategy rs_strategy;       /* access strategy for reads */
37         bool            rs_syncscan;    /* report location to syncscan logic? */
38
39         /* scan current state */
40         bool            rs_inited;              /* false = scan not init'd yet */
41         HeapTupleData rs_ctup;          /* current tuple in scan, if any */
42         BlockNumber rs_cblock;          /* current block # in scan, if any */
43         Buffer          rs_cbuf;                /* current buffer in scan, if any */
44         /* NB: if rs_cbuf is not InvalidBuffer, we hold a pin on that buffer */
45         ItemPointerData rs_mctid;       /* marked scan position, if any */
46
47         /* these fields only used in page-at-a-time mode and for bitmap scans */
48         int                     rs_cindex;              /* current tuple's index in vistuples */
49         int                     rs_mindex;              /* marked tuple's saved index */
50         int                     rs_ntuples;             /* number of visible tuples on page */
51         OffsetNumber rs_vistuples[MaxHeapTuplesPerPage];        /* their offsets */
52 } HeapScanDescData;
53
54 /*
55  * We use the same IndexScanDescData structure for both amgettuple-based
56  * and amgetbitmap-based index scans.  Some fields are only relevant in
57  * amgettuple-based scans.
58  */
59 typedef struct IndexScanDescData
60 {
61         /* scan parameters */
62         Relation        heapRelation;   /* heap relation descriptor, or NULL */
63         Relation        indexRelation;  /* index relation descriptor */
64         Snapshot        xs_snapshot;    /* snapshot to see */
65         int                     numberOfKeys;   /* number of scan keys */
66         ScanKey         keyData;                /* array of scan key descriptors */
67
68         /* signaling to index AM about killing index tuples */
69         bool            kill_prior_tuple;               /* last-returned tuple is dead */
70         bool            ignore_killed_tuples;   /* do not return killed entries */
71         bool            xactStartedInRecovery;  /* prevents killing/seeing killed
72                                                                                  * tuples */
73
74         /* index access method's private state */
75         void       *opaque;                     /* access-method-specific info */
76
77         /* xs_ctup/xs_cbuf/xs_recheck are valid after a successful index_getnext */
78         HeapTupleData xs_ctup;          /* current heap tuple, if any */
79         Buffer          xs_cbuf;                /* current heap buffer in scan, if any */
80         /* NB: if xs_cbuf is not InvalidBuffer, we hold a pin on that buffer */
81         bool            xs_recheck;             /* T means scan keys must be rechecked */
82
83         /* state data for traversing HOT chains in index_getnext */
84         bool            xs_hot_dead;    /* T if all members of HOT chain are dead */
85         OffsetNumber xs_next_hot;       /* next member of HOT chain, if any */
86         TransactionId xs_prev_xmax; /* previous HOT chain member's XMAX, if any */
87 } IndexScanDescData;
88
89 /* Struct for heap-or-index scans of system tables */
90 typedef struct SysScanDescData
91 {
92         Relation        heap_rel;               /* catalog being scanned */
93         Relation        irel;                   /* NULL if doing heap scan */
94         HeapScanDesc scan;                      /* only valid in heap-scan case */
95         IndexScanDesc iscan;            /* only valid in index-scan case */
96 } SysScanDescData;
97
98 #endif   /* RELSCAN_H */