Don't include genam.h from execnodes.h and relscan.h anymore.

This is the genam.h equivalent of 4c850ecec6 (which removed
heapam.h from a lot of other headers).  There's still a few header
includes of genam.h, but not from central headers anymore.

As a few headers are not indirectly included anymore, execnodes.h and
relscan.h need a few additional includes. Some of the depended on
types were replacable by using the underlying structs, but e.g. for
Snapshot in execnodes.h that'd have gotten more invasive than
reasonable in this commit.

Like the aforementioned commit 4c850ecec6, this requires adding new
genam.h includes to a number of backend files, which likely is also
required in a few external projects.

Author: Andres Freund
Discussion: https://postgr.es/m/20190114000701.y4ttcb74jpskkcfb@alap3.anarazel.de
This commit is contained in:
Andres Freund 2019-01-14 17:02:12 -08:00
parent 774a975c9a
commit 0944ec54de
22 changed files with 45 additions and 23 deletions

View File

@ -39,6 +39,7 @@
#include "postgres.h"
#include "access/bufmask.h"
#include "access/genam.h"
#include "access/heapam.h"
#include "access/heapam_xlog.h"
#include "access/hio.h"

View File

@ -19,6 +19,7 @@
#include "postgres.h"
#include "access/genam.h"
#include "access/heapam.h"
#include "access/relscan.h"
#include "access/transam.h"

View File

@ -17,6 +17,7 @@
#include <unistd.h>
#include <signal.h>
#include "access/genam.h"
#include "access/heapam.h"
#include "access/htup_details.h"
#include "access/xact.h"

View File

@ -14,6 +14,7 @@
*/
#include "postgres.h"
#include "access/genam.h"
#include "access/htup_details.h"
#include "access/heapam.h"
#include "access/xact.h"

View File

@ -29,6 +29,7 @@
*/
#include "postgres.h"
#include "access/genam.h"
#include "access/heapam.h"
#include "access/htup_details.h"
#include "access/multixact.h"

View File

@ -15,6 +15,7 @@
*/
#include "postgres.h"
#include "access/genam.h"
#include "access/heapam.h"
#include "access/htup_details.h"
#include "catalog/index.h"

View File

@ -15,6 +15,7 @@
#include "postgres.h"
#include "access/genam.h"
#include "access/heapam.h"
#include "access/htup_details.h"
#include "access/sysattr.h"

View File

@ -16,6 +16,7 @@
#include <math.h>
#include "access/genam.h"
#include "access/heapam.h"
#include "access/multixact.h"
#include "access/sysattr.h"

View File

@ -13,6 +13,7 @@
*/
#include "postgres.h"
#include "access/genam.h"
#include "access/heapam.h"
#include "catalog/index.h"
#include "commands/trigger.h"

View File

@ -29,6 +29,7 @@
#include <sys/stat.h>
#include <unistd.h>
#include "access/genam.h"
#include "access/heapam.h"
#include "access/htup_details.h"
#include "access/sysattr.h"

View File

@ -14,6 +14,7 @@
*/
#include "postgres.h"
#include "access/genam.h"
#include "access/heapam.h"
#include "access/htup_details.h"
#include "access/multixact.h"

View File

@ -31,6 +31,7 @@
*/
#include "postgres.h"
#include "access/genam.h"
#include "access/heapam.h"
#include "access/htup_details.h"
#include "access/xact.h"

View File

@ -12,6 +12,7 @@
*/
#include "postgres.h"
#include "access/genam.h"
#include "access/relscan.h"
#include "access/sysattr.h"
#include "catalog/pg_type.h"

View File

@ -106,6 +106,7 @@
*/
#include "postgres.h"
#include "access/genam.h"
#include "access/relscan.h"
#include "access/xact.h"
#include "catalog/index.h"

View File

@ -14,6 +14,7 @@
#include "postgres.h"
#include "access/genam.h"
#include "access/heapam.h"
#include "access/relscan.h"
#include "access/transam.h"

View File

@ -21,6 +21,7 @@
*/
#include "postgres.h"
#include "access/genam.h"
#include "executor/execdebug.h"
#include "executor/nodeBitmapIndexscan.h"
#include "executor/nodeIndexscan.h"

View File

@ -30,7 +30,9 @@
*/
#include "postgres.h"
#include "access/genam.h"
#include "access/relscan.h"
#include "access/tupdesc.h"
#include "access/visibilitymap.h"
#include "executor/execdebug.h"
#include "executor/nodeIndexonlyscan.h"

View File

@ -18,6 +18,7 @@
#include <limits.h>
#include <math.h>
#include "access/genam.h"
#include "access/heapam.h"
#include "access/htup_details.h"
#include "access/parallel.h"

View File

@ -19,6 +19,7 @@
#include <fcntl.h>
#include <unistd.h>
#include "access/genam.h"
#include "access/heapam.h"
#include "access/htup_details.h"
#include "access/session.h"

View File

@ -14,11 +14,12 @@
#ifndef RELSCAN_H
#define RELSCAN_H
#include "access/genam.h"
#include "access/htup_details.h"
#include "access/itup.h"
#include "access/tupdesc.h"
#include "port/atomics.h"
#include "storage/buf.h"
#include "storage/spin.h"
#include "utils/relcache.h"
/*
* Shared state for parallel heap scan.
@ -46,9 +47,9 @@ typedef struct HeapScanDescData
{
/* scan parameters */
Relation rs_rd; /* heap relation descriptor */
Snapshot rs_snapshot; /* snapshot to see */
struct SnapshotData *rs_snapshot; /* snapshot to see */
int rs_nkeys; /* number of scan keys */
ScanKey rs_key; /* array of scan key descriptors */
struct ScanKeyData *rs_key; /* array of scan key descriptors */
bool rs_bitmapscan; /* true if this is really a bitmap scan */
bool rs_samplescan; /* true if this is really a sample scan */
bool rs_pageatatime; /* verify visibility page-at-a-time? */
@ -88,11 +89,11 @@ typedef struct IndexScanDescData
/* scan parameters */
Relation heapRelation; /* heap relation descriptor, or NULL */
Relation indexRelation; /* index relation descriptor */
Snapshot xs_snapshot; /* snapshot to see */
struct SnapshotData *xs_snapshot; /* snapshot to see */
int numberOfKeys; /* number of index qualifier conditions */
int numberOfOrderBys; /* number of ordering operators */
ScanKey keyData; /* array of index qualifier descriptors */
ScanKey orderByData; /* array of ordering op descriptors */
struct ScanKeyData *keyData; /* array of index qualifier descriptors */
struct ScanKeyData *orderByData; /* array of ordering op descriptors */
bool xs_want_itup; /* caller requests index tuples */
bool xs_temp_snap; /* unregister snapshot at scan end? */
@ -112,9 +113,9 @@ typedef struct IndexScanDescData
* format will be used.
*/
IndexTuple xs_itup; /* index tuple returned by AM */
TupleDesc xs_itupdesc; /* rowtype descriptor of xs_itup */
struct TupleDescData *xs_itupdesc; /* rowtype descriptor of xs_itup */
HeapTuple xs_hitup; /* index data returned by AM, as HeapTuple */
TupleDesc xs_hitupdesc; /* rowtype descriptor of xs_hitup */
struct TupleDescData *xs_hitupdesc; /* rowtype descriptor of xs_hitup */
/* xs_ctup/xs_cbuf/xs_recheck are valid after a successful index_getnext */
HeapTupleData xs_ctup; /* current heap tuple, if any */
@ -137,7 +138,7 @@ typedef struct IndexScanDescData
bool xs_continue_hot; /* T if must keep walking HOT chain */
/* parallel index scan information, in shared memory */
ParallelIndexScanDesc parallel_scan;
struct ParallelIndexScanDescData *parallel_scan;
} IndexScanDescData;
/* Generic structure for parallel scans */
@ -155,8 +156,8 @@ typedef struct SysScanDescData
Relation heap_rel; /* catalog being scanned */
Relation irel; /* NULL if doing heap scan */
struct HeapScanDescData *scan; /* only valid in heap-scan case */
IndexScanDesc iscan; /* only valid in index-scan case */
Snapshot snapshot; /* snapshot to unregister at end of scan */
struct IndexScanDescData *iscan; /* only valid in index-scan case */
struct SnapshotData *snapshot; /* snapshot to unregister at end of scan */
} SysScanDescData;
#endif /* RELSCAN_H */

View File

@ -14,6 +14,7 @@
#ifndef NODEINDEXSCAN_H
#define NODEINDEXSCAN_H
#include "access/genam.h"
#include "access/parallel.h"
#include "nodes/execnodes.h"

View File

@ -14,7 +14,6 @@
#ifndef EXECNODES_H
#define EXECNODES_H
#include "access/genam.h"
#include "access/tupconvert.h"
#include "executor/instrument.h"
#include "lib/pairingheap.h"
@ -24,6 +23,7 @@
#include "utils/queryenvironment.h"
#include "utils/reltrigger.h"
#include "utils/sharedtuplestore.h"
#include "utils/snapshot.h"
#include "utils/sortsupport.h"
#include "utils/tuplestore.h"
#include "utils/tuplesort.h"
@ -1306,14 +1306,14 @@ typedef struct SampleScanState
*/
typedef struct
{
ScanKey scan_key; /* scankey to put value into */
struct ScanKeyData *scan_key; /* scankey to put value into */
ExprState *key_expr; /* expr to evaluate to get value */
bool key_toastable; /* is expr's result a toastable datatype? */
} IndexRuntimeKeyInfo;
typedef struct
{
ScanKey scan_key; /* scankey to put value into */
struct ScanKeyData *scan_key; /* scankey to put value into */
ExprState *array_expr; /* expr to evaluate to get array value */
int next_elem; /* next array element to use */
int num_elems; /* number of elems in current array value */
@ -1352,16 +1352,16 @@ typedef struct IndexScanState
ScanState ss; /* its first field is NodeTag */
ExprState *indexqualorig;
List *indexorderbyorig;
ScanKey iss_ScanKeys;
struct ScanKeyData *iss_ScanKeys;
int iss_NumScanKeys;
ScanKey iss_OrderByKeys;
struct ScanKeyData *iss_OrderByKeys;
int iss_NumOrderByKeys;
IndexRuntimeKeyInfo *iss_RuntimeKeys;
int iss_NumRuntimeKeys;
bool iss_RuntimeKeysReady;
ExprContext *iss_RuntimeContext;
Relation iss_RelationDesc;
IndexScanDesc iss_ScanDesc;
struct IndexScanDescData *iss_ScanDesc;
/* These are needed for re-checking ORDER BY expr ordering */
pairingheap *iss_ReorderQueue;
@ -1397,16 +1397,16 @@ typedef struct IndexOnlyScanState
{
ScanState ss; /* its first field is NodeTag */
ExprState *indexqual;
ScanKey ioss_ScanKeys;
struct ScanKeyData *ioss_ScanKeys;
int ioss_NumScanKeys;
ScanKey ioss_OrderByKeys;
struct ScanKeyData *ioss_OrderByKeys;
int ioss_NumOrderByKeys;
IndexRuntimeKeyInfo *ioss_RuntimeKeys;
int ioss_NumRuntimeKeys;
bool ioss_RuntimeKeysReady;
ExprContext *ioss_RuntimeContext;
Relation ioss_RelationDesc;
IndexScanDesc ioss_ScanDesc;
struct IndexScanDescData *ioss_ScanDesc;
Buffer ioss_VMBuffer;
Size ioss_PscanLen;
} IndexOnlyScanState;
@ -1431,7 +1431,7 @@ typedef struct BitmapIndexScanState
{
ScanState ss; /* its first field is NodeTag */
TIDBitmap *biss_result;
ScanKey biss_ScanKeys;
struct ScanKeyData *biss_ScanKeys;
int biss_NumScanKeys;
IndexRuntimeKeyInfo *biss_RuntimeKeys;
int biss_NumRuntimeKeys;
@ -1440,7 +1440,7 @@ typedef struct BitmapIndexScanState
bool biss_RuntimeKeysReady;
ExprContext *biss_RuntimeContext;
Relation biss_RelationDesc;
IndexScanDesc biss_ScanDesc;
struct IndexScanDescData *biss_ScanDesc;
} BitmapIndexScanState;
/* ----------------