Skip to content

Commit 4c850ec

Browse files
committed
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/[email protected]
1 parent 42e2a58 commit 4c850ec

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

71 files changed

+91
-36
lines changed

contrib/amcheck/verify_nbtree.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@
2323
*/
2424
#include "postgres.h"
2525

26+
#include "access/heapam.h"
2627
#include "access/htup_details.h"
2728
#include "access/nbtree.h"
2829
#include "access/transam.h"

contrib/dblink/dblink.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,7 @@
3838

3939
#include "access/htup_details.h"
4040
#include "access/reloptions.h"
41+
#include "access/heapam.h"
4142
#include "catalog/indexing.h"
4243
#include "catalog/namespace.h"
4344
#include "catalog/pg_foreign_data_wrapper.h"

contrib/file_fdw/file_fdw.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@
1818
#include "access/htup_details.h"
1919
#include "access/reloptions.h"
2020
#include "access/sysattr.h"
21+
#include "access/heapam.h"
2122
#include "catalog/pg_authid.h"
2223
#include "catalog/pg_foreign_table.h"
2324
#include "commands/copy.h"

contrib/pageinspect/btreefuncs.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,7 @@
3030
#include "pageinspect.h"
3131

3232
#include "access/nbtree.h"
33+
#include "access/heapam.h"
3334
#include "catalog/namespace.h"
3435
#include "catalog/pg_am.h"
3536
#include "funcapi.h"

contrib/pageinspect/heapfuncs.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,7 @@
2727

2828
#include "pageinspect.h"
2929

30+
#include "access/heapam.h"
3031
#include "access/htup_details.h"
3132
#include "funcapi.h"
3233
#include "catalog/pg_type.h"

contrib/pageinspect/rawpage.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@
1818
#include "pageinspect.h"
1919

2020
#include "access/htup_details.h"
21+
#include "access/heapam.h"
2122
#include "catalog/namespace.h"
2223
#include "catalog/pg_type.h"
2324
#include "funcapi.h"

contrib/pg_freespacemap/pg_freespacemap.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@
88
*/
99
#include "postgres.h"
1010

11+
#include "access/heapam.h"
1112
#include "funcapi.h"
1213
#include "storage/freespace.h"
1314

contrib/pg_visibility/pg_visibility.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@
1010
*/
1111
#include "postgres.h"
1212

13+
#include "access/heapam.h"
1314
#include "access/htup_details.h"
1415
#include "access/visibilitymap.h"
1516
#include "catalog/pg_type.h"

contrib/pgrowlocks/pgrowlocks.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@
2424

2525
#include "postgres.h"
2626

27+
#include "access/heapam.h"
2728
#include "access/multixact.h"
2829
#include "access/relscan.h"
2930
#include "access/xact.h"

contrib/pgstattuple/pgstatapprox.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@
1313
#include "postgres.h"
1414

1515
#include "access/visibilitymap.h"
16+
#include "access/heapam.h"
1617
#include "access/transam.h"
1718
#include "access/xact.h"
1819
#include "access/multixact.h"

0 commit comments

Comments
 (0)