OSDN Git Service

rebuid:
[eos/hostdependX86MAC64.git] / util / X86MAC64 / include / postgresql / server / access / relscan.h
1 /*-------------------------------------------------------------------------
2  *
3  * relscan.h
4  *        POSTGRES relation scan descriptor definitions.
5  *
6  *
7  * Portions Copyright (c) 1996-2014, 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 #include "access/htup_details.h"
20 #include "access/itup.h"
21 #include "access/tupdesc.h"
22
23
24 typedef struct HeapScanDescData
25 {
26         /* scan parameters */
27         Relation        rs_rd;                  /* heap relation descriptor */
28         Snapshot        rs_snapshot;    /* snapshot to see */
29         int                     rs_nkeys;               /* number of scan keys */
30         ScanKey         rs_key;                 /* array of scan key descriptors */
31         bool            rs_bitmapscan;  /* true if this is really a bitmap scan */
32         bool            rs_pageatatime; /* verify visibility page-at-a-time? */
33         bool            rs_allow_strat; /* allow or disallow use of access strategy */
34         bool            rs_allow_sync;  /* allow or disallow use of syncscan */
35         bool            rs_temp_snap;   /* unregister snapshot at scan end? */
36
37         /* state set up at initscan time */
38         BlockNumber rs_nblocks;         /* number of blocks to scan */
39         BlockNumber rs_startblock;      /* block # to start at */
40         BufferAccessStrategy rs_strategy;       /* access strategy for reads */
41         bool            rs_syncscan;    /* report location to syncscan logic? */
42
43         /* scan current state */
44         bool            rs_inited;              /* false = scan not init'd yet */
45         HeapTupleData rs_ctup;          /* current tuple in scan, if any */
46         BlockNumber rs_cblock;          /* current block # in scan, if any */
47         Buffer          rs_cbuf;                /* current buffer in scan, if any */
48         /* NB: if rs_cbuf is not InvalidBuffer, we hold a pin on that buffer */
49         ItemPointerData rs_mctid;       /* marked scan position, if any */
50
51         /* these fields only used in page-at-a-time mode and for bitmap scans */
52         int                     rs_cindex;              /* current tuple's index in vistuples */
53         int                     rs_mindex;              /* marked tuple's saved index */
54         int                     rs_ntuples;             /* number of visible tuples on page */
55         OffsetNumber rs_vistuples[MaxHeapTuplesPerPage];        /* their offsets */
56 }       HeapScanDescData;
57
58 /*
59  * We use the same IndexScanDescData structure for both amgettuple-based
60  * and amgetbitmap-based index scans.  Some fields are only relevant in
61  * amgettuple-based scans.
62  */
63 typedef struct IndexScanDescData
64 {
65         /* scan parameters */
66         Relation        heapRelation;   /* heap relation descriptor, or NULL */
67         Relation        indexRelation;  /* index relation descriptor */
68         Snapshot        xs_snapshot;    /* snapshot to see */
69         int                     numberOfKeys;   /* number of index qualifier conditions */
70         int                     numberOfOrderBys;               /* number of ordering operators */
71         ScanKey         keyData;                /* array of index qualifier descriptors */
72         ScanKey         orderByData;    /* array of ordering op descriptors */
73         bool            xs_want_itup;   /* caller requests index tuples */
74
75         /* signaling to index AM about killing index tuples */
76         bool            kill_prior_tuple;               /* last-returned tuple is dead */
77         bool            ignore_killed_tuples;   /* do not return killed entries */
78         bool            xactStartedInRecovery;  /* prevents killing/seeing killed
79                                                                                  * tuples */
80
81         /* index access method's private state */
82         void       *opaque;                     /* access-method-specific info */
83
84         /* in an index-only scan, this is valid after a successful amgettuple */
85         IndexTuple      xs_itup;                /* index tuple returned by AM */
86         TupleDesc       xs_itupdesc;    /* rowtype descriptor of xs_itup */
87
88         /* xs_ctup/xs_cbuf/xs_recheck are valid after a successful index_getnext */
89         HeapTupleData xs_ctup;          /* current heap tuple, if any */
90         Buffer          xs_cbuf;                /* current heap buffer in scan, if any */
91         /* NB: if xs_cbuf is not InvalidBuffer, we hold a pin on that buffer */
92         bool            xs_recheck;             /* T means scan keys must be rechecked */
93
94         /* state data for traversing HOT chains in index_getnext */
95         bool            xs_continue_hot;        /* T if must keep walking HOT chain */
96 }       IndexScanDescData;
97
98 /* Struct for heap-or-index scans of system tables */
99 typedef struct SysScanDescData
100 {
101         Relation        heap_rel;               /* catalog being scanned */
102         Relation        irel;                   /* NULL if doing heap scan */
103         HeapScanDesc scan;                      /* only valid in heap-scan case */
104         IndexScanDesc iscan;            /* only valid in index-scan case */
105         Snapshot        snapshot;               /* snapshot to unregister at end of scan */
106 }       SysScanDescData;
107
108 #endif   /* RELSCAN_H */