diff options
author | Andres Freund <andres@anarazel.de> | 2019-01-14 15:54:18 -0800 |
---|---|---|
committer | Andres Freund <andres@anarazel.de> | 2019-01-14 16:24:41 -0800 |
commit | 4c850ecec649c1b1538c741b89cf65d8f7d61853 (patch) | |
tree | 616cd9ae1c2e1dd8e6d38de606e7133235964437 /src/backend/executor | |
parent | 42e2a580713201645d7caa4b27713ac777432d8d (diff) | |
download | postgresql-4c850ecec649c1b1538c741b89cf65d8f7d61853.tar.gz postgresql-4c850ecec649c1b1538c741b89cf65d8f7d61853.zip |
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
Diffstat (limited to 'src/backend/executor')
-rw-r--r-- | src/backend/executor/execMain.c | 11 | ||||
-rw-r--r-- | src/backend/executor/execPartition.c | 1 | ||||
-rw-r--r-- | src/backend/executor/execReplication.c | 1 | ||||
-rw-r--r-- | src/backend/executor/execUtils.c | 1 | ||||
-rw-r--r-- | src/backend/executor/nodeBitmapHeapscan.c | 1 | ||||
-rw-r--r-- | src/backend/executor/nodeLockRows.c | 1 | ||||
-rw-r--r-- | src/backend/executor/nodeModifyTable.c | 1 | ||||
-rw-r--r-- | src/backend/executor/nodeSamplescan.c | 1 | ||||
-rw-r--r-- | src/backend/executor/nodeSeqscan.c | 1 | ||||
-rw-r--r-- | src/backend/executor/nodeTidscan.c | 1 |
10 files changed, 12 insertions, 8 deletions
diff --git a/src/backend/executor/execMain.c b/src/backend/executor/execMain.c index 26e41902f3a..ed0330056bf 100644 --- a/src/backend/executor/execMain.c +++ b/src/backend/executor/execMain.c @@ -37,6 +37,7 @@ */ #include "postgres.h" +#include "access/heapam.h" #include "access/htup_details.h" #include "access/sysattr.h" #include "access/transam.h" @@ -2435,13 +2436,10 @@ ExecBuildAuxRowMark(ExecRowMark *erm, List *targetlist) * * Returns a slot containing the new candidate update/delete tuple, or * NULL if we determine we shouldn't process the row. - * - * Note: properly, lockmode should be declared as enum LockTupleMode, - * but we use "int" to avoid having to include heapam.h in executor.h. */ TupleTableSlot * EvalPlanQual(EState *estate, EPQState *epqstate, - Relation relation, Index rti, int lockmode, + Relation relation, Index rti, LockTupleMode lockmode, ItemPointer tid, TransactionId priorXmax) { TupleTableSlot *slot; @@ -2522,12 +2520,9 @@ EvalPlanQual(EState *estate, EPQState *epqstate, * * If successful, we have locked the newest tuple version, so caller does not * need to worry about it changing anymore. - * - * Note: properly, lockmode should be declared as enum LockTupleMode, - * but we use "int" to avoid having to include heapam.h in executor.h. */ HeapTuple -EvalPlanQualFetch(EState *estate, Relation relation, int lockmode, +EvalPlanQualFetch(EState *estate, Relation relation, LockTupleMode lockmode, LockWaitPolicy wait_policy, ItemPointer tid, TransactionId priorXmax) { diff --git a/src/backend/executor/execPartition.c b/src/backend/executor/execPartition.c index 3a1004ff477..7415dfa45eb 100644 --- a/src/backend/executor/execPartition.c +++ b/src/backend/executor/execPartition.c @@ -13,6 +13,7 @@ */ #include "postgres.h" +#include "access/heapam.h" #include "catalog/partition.h" #include "catalog/pg_inherits.h" #include "catalog/pg_type.h" diff --git a/src/backend/executor/execReplication.c b/src/backend/executor/execReplication.c index a7eebc45e36..f7602f25553 100644 --- a/src/backend/executor/execReplication.c +++ b/src/backend/executor/execReplication.c @@ -14,6 +14,7 @@ #include "postgres.h" +#include "access/heapam.h" #include "access/relscan.h" #include "access/transam.h" #include "access/xact.h" diff --git a/src/backend/executor/execUtils.c b/src/backend/executor/execUtils.c index 24ab43d5e5c..d914d4b5006 100644 --- a/src/backend/executor/execUtils.c +++ b/src/backend/executor/execUtils.c @@ -45,6 +45,7 @@ #include "postgres.h" +#include "access/heapam.h" #include "access/parallel.h" #include "access/relscan.h" #include "access/transam.h" diff --git a/src/backend/executor/nodeBitmapHeapscan.c b/src/backend/executor/nodeBitmapHeapscan.c index f8d70f25920..cd20abc141e 100644 --- a/src/backend/executor/nodeBitmapHeapscan.c +++ b/src/backend/executor/nodeBitmapHeapscan.c @@ -37,6 +37,7 @@ #include <math.h> +#include "access/heapam.h" #include "access/relscan.h" #include "access/transam.h" #include "access/visibilitymap.h" diff --git a/src/backend/executor/nodeLockRows.c b/src/backend/executor/nodeLockRows.c index c80536931ec..6b9d9bf2b8d 100644 --- a/src/backend/executor/nodeLockRows.c +++ b/src/backend/executor/nodeLockRows.c @@ -21,6 +21,7 @@ #include "postgres.h" +#include "access/heapam.h" #include "access/htup_details.h" #include "access/xact.h" #include "executor/executor.h" diff --git a/src/backend/executor/nodeModifyTable.c b/src/backend/executor/nodeModifyTable.c index 84ac2e63add..e18bc2a42e2 100644 --- a/src/backend/executor/nodeModifyTable.c +++ b/src/backend/executor/nodeModifyTable.c @@ -37,6 +37,7 @@ #include "postgres.h" +#include "access/heapam.h" #include "access/htup_details.h" #include "access/xact.h" #include "catalog/catalog.h" diff --git a/src/backend/executor/nodeSamplescan.c b/src/backend/executor/nodeSamplescan.c index c75f9f3a75b..7d4f17b4e99 100644 --- a/src/backend/executor/nodeSamplescan.c +++ b/src/backend/executor/nodeSamplescan.c @@ -15,6 +15,7 @@ #include "postgres.h" #include "access/hash.h" +#include "access/heapam.h" #include "access/relscan.h" #include "access/tsmapi.h" #include "executor/executor.h" diff --git a/src/backend/executor/nodeSeqscan.c b/src/backend/executor/nodeSeqscan.c index 8c46873daaf..e5482859efc 100644 --- a/src/backend/executor/nodeSeqscan.c +++ b/src/backend/executor/nodeSeqscan.c @@ -27,6 +27,7 @@ */ #include "postgres.h" +#include "access/heapam.h" #include "access/relscan.h" #include "executor/execdebug.h" #include "executor/nodeSeqscan.h" diff --git a/src/backend/executor/nodeTidscan.c b/src/backend/executor/nodeTidscan.c index 9961e2b2c1a..b7a8725e2dc 100644 --- a/src/backend/executor/nodeTidscan.c +++ b/src/backend/executor/nodeTidscan.c @@ -22,6 +22,7 @@ */ #include "postgres.h" +#include "access/heapam.h" #include "access/sysattr.h" #include "catalog/pg_type.h" #include "executor/execdebug.h" |