mirror of
https://github.com/postgres/postgres.git
synced 2025-10-21 02:52:47 +03:00
Don't include heapam.h from others headers.
heapam.h previously was included in a number of widely used headers (e.g. execnodes.h, indirectly in executor.h, ...). That's problematic on its own, as heapam.h contains a lot of low-level details that don't need to be exposed that widely, but becomes more problematic with the upcoming introduction of pluggable table storage - it seems inappropriate for heapam.h to be included that widely afterwards. heapam.h was largely only included in other headers to get the HeapScanDesc typedef (which was defined in heapam.h, even though HeapScanDescData is defined in relscan.h). The better solution here seems to be to just use the underlying struct (forward declared where necessary). Similar for BulkInsertState. Another problem was that LockTupleMode was used in executor.h - parts of the file tried to cope without heapam.h, but due to the fact that it indirectly included it, several subsequent violations of that goal were not not noticed. We could just reuse the approach of declaring parameters as int, but it seems nicer to move LockTupleMode to lockoptions.h - that's not a perfect location, but also doesn't seem bad. As a number of files relied on implicitly included heapam.h, a significant number of files grew an explicit include. It's quite probably that a few external projects will need to do the same. Author: Andres Freund Reviewed-By: Alvaro Herrera Discussion: https://postgr.es/m/20190114000701.y4ttcb74jpskkcfb@alap3.anarazel.de
This commit is contained in:
@@ -33,21 +33,6 @@
|
||||
|
||||
typedef struct BulkInsertStateData *BulkInsertState;
|
||||
|
||||
/*
|
||||
* Possible lock modes for a tuple.
|
||||
*/
|
||||
typedef enum LockTupleMode
|
||||
{
|
||||
/* SELECT FOR KEY SHARE */
|
||||
LockTupleKeyShare,
|
||||
/* SELECT FOR SHARE */
|
||||
LockTupleShare,
|
||||
/* SELECT FOR NO KEY UPDATE, and UPDATEs that don't modify key columns */
|
||||
LockTupleNoKeyExclusive,
|
||||
/* SELECT FOR UPDATE, UPDATEs that modify key columns, and DELETE */
|
||||
LockTupleExclusive
|
||||
} LockTupleMode;
|
||||
|
||||
#define MaxLockTupleMode LockTupleExclusive
|
||||
|
||||
/*
|
||||
|
@@ -14,7 +14,6 @@
|
||||
#ifndef HIO_H
|
||||
#define HIO_H
|
||||
|
||||
#include "access/heapam.h"
|
||||
#include "access/htup.h"
|
||||
#include "utils/relcache.h"
|
||||
#include "storage/buf.h"
|
||||
@@ -39,7 +38,7 @@ extern void RelationPutHeapTuple(Relation relation, Buffer buffer,
|
||||
HeapTuple tuple, bool token);
|
||||
extern Buffer RelationGetBufferForTuple(Relation relation, Size len,
|
||||
Buffer otherBuffer, int options,
|
||||
BulkInsertState bistate,
|
||||
BulkInsertStateData *bistate,
|
||||
Buffer *vmbuffer, Buffer *vmbuffer_other);
|
||||
|
||||
#endif /* HIO_H */
|
||||
|
@@ -15,7 +15,6 @@
|
||||
#define RELSCAN_H
|
||||
|
||||
#include "access/genam.h"
|
||||
#include "access/heapam.h"
|
||||
#include "access/htup_details.h"
|
||||
#include "access/itup.h"
|
||||
#include "access/tupdesc.h"
|
||||
@@ -71,7 +70,7 @@ typedef struct HeapScanDescData
|
||||
BlockNumber rs_cblock; /* current block # in scan, if any */
|
||||
Buffer rs_cbuf; /* current buffer in scan, if any */
|
||||
/* NB: if rs_cbuf is not InvalidBuffer, we hold a pin on that buffer */
|
||||
ParallelHeapScanDesc rs_parallel; /* parallel scan information */
|
||||
struct ParallelHeapScanDescData *rs_parallel; /* parallel scan information */
|
||||
|
||||
/* these fields only used in page-at-a-time mode and for bitmap scans */
|
||||
int rs_cindex; /* current tuple's index in vistuples */
|
||||
@@ -155,7 +154,7 @@ typedef struct SysScanDescData
|
||||
{
|
||||
Relation heap_rel; /* catalog being scanned */
|
||||
Relation irel; /* NULL if doing heap scan */
|
||||
HeapScanDesc scan; /* only valid in heap-scan case */
|
||||
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 */
|
||||
} SysScanDescData;
|
||||
|
Reference in New Issue
Block a user