summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAlvaro Herrera2008-05-12 00:00:54 +0000
committerAlvaro Herrera2008-05-12 00:00:54 +0000
commitb474087294841c630cb74b45001c47939272401f (patch)
tree5ccf8331883c523afd64825f5c348f95814f5cda
parent2d0253c164d8c9dbdcc530914d7d39e69c1a2fa5 (diff)
Restructure some header files a bit, in particular heapam.h, by removing some
unnecessary #include lines in it. Also, move some tuple routine prototypes and macros to htup.h, which allows removal of heapam.h inclusion from some .c files. For this to work, a new header file access/sysattr.h needed to be created, initially containing attribute numbers of system columns, for pg_dump usage. While at it, make contrib ltree, intarray and hstore header files more consistent with our header style.
-rw-r--r--contrib/hstore/hstore.h15
-rw-r--r--contrib/hstore/hstore_gin.c8
-rw-r--r--contrib/hstore/hstore_gist.c8
-rw-r--r--contrib/hstore/hstore_io.c8
-rw-r--r--contrib/hstore/hstore_op.c13
-rw-r--r--contrib/intagg/int_aggregate.c2
-rw-r--r--contrib/intarray/_int.h13
-rw-r--r--contrib/intarray/_int_bool.c4
-rw-r--r--contrib/intarray/_int_gin.c5
-rw-r--r--contrib/intarray/_int_gist.c5
-rw-r--r--contrib/intarray/_int_op.c5
-rw-r--r--contrib/intarray/_int_tool.c4
-rw-r--r--contrib/intarray/_intbig_gist.c5
-rw-r--r--contrib/ltree/_ltree_gist.c5
-rw-r--r--contrib/ltree/_ltree_op.c4
-rw-r--r--contrib/ltree/lquery_op.c4
-rw-r--r--contrib/ltree/ltree.h4
-rw-r--r--contrib/ltree/ltree_gist.c3
-rw-r--r--contrib/ltree/ltree_io.c4
-rw-r--r--contrib/ltree/ltree_op.c5
-rw-r--r--contrib/ltree/ltxtquery_io.c4
-rw-r--r--contrib/ltree/ltxtquery_op.c4
-rw-r--r--contrib/pageinspect/btreefuncs.c1
-rw-r--r--contrib/pageinspect/rawpage.c7
-rw-r--r--contrib/pg_freespacemap/pg_freespacemap.c5
-rw-r--r--contrib/pgrowlocks/pgrowlocks.c1
-rw-r--r--contrib/pgstattuple/pgstatindex.c1
-rw-r--r--contrib/pgstattuple/pgstattuple.c2
-rw-r--r--src/backend/access/common/heaptuple.c1
-rw-r--r--src/backend/access/gin/ginbtree.c2
-rw-r--r--src/backend/access/gin/gindatapage.c2
-rw-r--r--src/backend/access/gin/ginentrypage.c1
-rw-r--r--src/backend/access/gin/ginget.c1
-rw-r--r--src/backend/access/gin/gininsert.c1
-rw-r--r--src/backend/access/gin/ginscan.c2
-rw-r--r--src/backend/access/gin/ginutil.c3
-rw-r--r--src/backend/access/gin/ginvacuum.c7
-rw-r--r--src/backend/access/gin/ginxlog.c3
-rw-r--r--src/backend/access/gist/gist.c1
-rw-r--r--src/backend/access/gist/gistget.c1
-rw-r--r--src/backend/access/gist/gistscan.c1
-rw-r--r--src/backend/access/gist/gistutil.c3
-rw-r--r--src/backend/access/gist/gistvacuum.c3
-rw-r--r--src/backend/access/gist/gistxlog.c3
-rw-r--r--src/backend/access/hash/hash.c1
-rw-r--r--src/backend/access/hash/hashinsert.c1
-rw-r--r--src/backend/access/hash/hashovfl.c1
-rw-r--r--src/backend/access/hash/hashpage.c1
-rw-r--r--src/backend/access/hash/hashsearch.c1
-rw-r--r--src/backend/access/hash/hashutil.c1
-rw-r--r--src/backend/access/heap/heapam.c4
-rw-r--r--src/backend/access/heap/hio.c4
-rw-r--r--src/backend/access/heap/pruneheap.c4
-rw-r--r--src/backend/access/heap/rewriteheap.c1
-rw-r--r--src/backend/access/heap/syncscan.c3
-rw-r--r--src/backend/access/index/indexam.c2
-rw-r--r--src/backend/access/nbtree/nbtinsert.c2
-rw-r--r--src/backend/access/nbtree/nbtpage.c1
-rw-r--r--src/backend/access/nbtree/nbtree.c1
-rw-r--r--src/backend/access/nbtree/nbtsearch.c1
-rw-r--r--src/backend/access/nbtree/nbtutils.c1
-rw-r--r--src/backend/access/nbtree/nbtxlog.c1
-rw-r--r--src/backend/access/transam/twophase.c2
-rw-r--r--src/backend/access/transam/xact.c1
-rw-r--r--src/backend/access/transam/xlog.c2
-rw-r--r--src/backend/access/transam/xlogutils.c1
-rw-r--r--src/backend/bootstrap/bootstrap.c1
-rw-r--r--src/backend/catalog/aclchk.c1
-rw-r--r--src/backend/catalog/catalog.c1
-rw-r--r--src/backend/catalog/dependency.c1
-rw-r--r--src/backend/catalog/heap.c2
-rw-r--r--src/backend/catalog/index.c3
-rw-r--r--src/backend/catalog/pg_conversion.c1
-rw-r--r--src/backend/catalog/pg_shdepend.c1
-rw-r--r--src/backend/commands/analyze.c1
-rw-r--r--src/backend/commands/cluster.c1
-rw-r--r--src/backend/commands/dbcommands.c3
-rw-r--r--src/backend/commands/functioncmds.c1
-rw-r--r--src/backend/commands/indexcmds.c1
-rw-r--r--src/backend/commands/opclasscmds.c1
-rw-r--r--src/backend/commands/prepare.c1
-rw-r--r--src/backend/commands/sequence.c3
-rw-r--r--src/backend/commands/tablecmds.c2
-rw-r--r--src/backend/commands/tablespace.c1
-rw-r--r--src/backend/commands/trigger.c2
-rw-r--r--src/backend/commands/user.c1
-rw-r--r--src/backend/commands/vacuum.c2
-rw-r--r--src/backend/commands/vacuumlazy.c2
-rw-r--r--src/backend/executor/execCurrent.c1
-rw-r--r--src/backend/executor/execMain.c2
-rw-r--r--src/backend/executor/execQual.c1
-rw-r--r--src/backend/executor/execTuples.c2
-rw-r--r--src/backend/executor/nodeAgg.c1
-rw-r--r--src/backend/executor/nodeBitmapHeapscan.c1
-rw-r--r--src/backend/executor/nodeSubplan.c1
-rw-r--r--src/backend/executor/nodeTidscan.c2
-rw-r--r--src/backend/executor/spi.c1
-rw-r--r--src/backend/optimizer/path/tidpath.c2
-rw-r--r--src/backend/optimizer/prep/preptlist.c1
-rw-r--r--src/backend/optimizer/util/clauses.c1
-rw-r--r--src/backend/optimizer/util/plancat.c2
-rw-r--r--src/backend/optimizer/util/var.c2
-rw-r--r--src/backend/parser/parse_relation.c1
-rw-r--r--src/backend/postmaster/autovacuum.c1
-rw-r--r--src/backend/postmaster/bgwriter.c1
-rw-r--r--src/backend/rewrite/rewriteRemove.c1
-rw-r--r--src/backend/storage/buffer/bufmgr.c1
-rw-r--r--src/backend/storage/ipc/ipci.c1
-rw-r--r--src/backend/tcop/postgres.c1
-rw-r--r--src/backend/tsearch/wparser.c1
-rw-r--r--src/backend/utils/adt/arrayfuncs.c1
-rw-r--r--src/backend/utils/adt/datetime.c1
-rw-r--r--src/backend/utils/adt/genfile.c1
-rw-r--r--src/backend/utils/adt/lockfuncs.c1
-rw-r--r--src/backend/utils/adt/pgstatfuncs.c1
-rw-r--r--src/backend/utils/adt/rowtypes.c1
-rw-r--r--src/backend/utils/adt/ruleutils.c1
-rw-r--r--src/backend/utils/adt/selfuncs.c1
-rw-r--r--src/backend/utils/adt/tid.c1
-rw-r--r--src/backend/utils/adt/varlena.c1
-rw-r--r--src/backend/utils/adt/xml.c1
-rw-r--r--src/backend/utils/cache/catcache.c1
-rw-r--r--src/backend/utils/cache/relcache.c2
-rw-r--r--src/backend/utils/cache/syscache.c2
-rw-r--r--src/backend/utils/fmgr/fmgr.c1
-rw-r--r--src/backend/utils/init/flatfiles.c3
-rw-r--r--src/backend/utils/init/postinit.c2
-rw-r--r--src/backend/utils/misc/guc.c1
-rw-r--r--src/backend/utils/mmgr/portalmem.c1
-rw-r--r--src/backend/utils/resowner/resowner.c1
-rw-r--r--src/backend/utils/sort/tuplesort.c1
-rw-r--r--src/backend/utils/sort/tuplestore.c1
-rw-r--r--src/bin/pg_dump/pg_dump.c2
-rw-r--r--src/include/access/genam.h3
-rw-r--r--src/include/access/gin.h12
-rw-r--r--src/include/access/gist.h1
-rw-r--r--src/include/access/gistscan.h2
-rw-r--r--src/include/access/heapam.h134
-rw-r--r--src/include/access/htup.h143
-rw-r--r--src/include/access/relscan.h1
-rw-r--r--src/include/access/sysattr.h31
-rw-r--r--src/include/access/tuptoaster.h1
-rw-r--r--src/include/parser/parser.h2
-rw-r--r--src/include/rewrite/rewriteDefine.h1
-rw-r--r--src/include/storage/bufpage.h3
-rw-r--r--src/include/storage/lmgr.h1
-rw-r--r--src/include/storage/lock.h2
-rw-r--r--src/include/utils/tuplesort.h1
-rw-r--r--src/pl/plpgsql/src/pl_comp.c1
-rw-r--r--src/pl/plpgsql/src/pl_exec.c1
-rw-r--r--src/pl/plpgsql/src/pl_handler.c1
-rw-r--r--src/pl/plpython/plpython.c1
-rw-r--r--src/pl/tcl/pltcl.c1
153 files changed, 405 insertions, 249 deletions
diff --git a/contrib/hstore/hstore.h b/contrib/hstore/hstore.h
index 48ec6e0648..84c3f41109 100644
--- a/contrib/hstore/hstore.h
+++ b/contrib/hstore/hstore.h
@@ -1,15 +1,10 @@
+/*
+ * $PostgreSQL$
+ */
#ifndef __HSTORE_H__
#define __HSTORE_H__
-#include "postgres.h"
-
-#include "funcapi.h"
-#include "access/gist.h"
-#include "access/itup.h"
-#include "utils/elog.h"
-#include "utils/palloc.h"
-#include "utils/builtins.h"
-#include "storage/bufpage.h"
+#include "fmgr.h"
typedef struct
@@ -53,4 +48,4 @@ int uniquePairs(Pairs * a, int4 l, int4 *buflen);
#define HStoreContainsStrategyNumber 7
#define HStoreExistsStrategyNumber 9
-#endif
+#endif /* __HSTORE_H__ */
diff --git a/contrib/hstore/hstore_gin.c b/contrib/hstore/hstore_gin.c
index aec25b2b65..a4be8059b9 100644
--- a/contrib/hstore/hstore_gin.c
+++ b/contrib/hstore/hstore_gin.c
@@ -1,7 +1,13 @@
-#include "hstore.h"
+/*
+ * $PostgreSQL$
+ */
+#include "postgres.h"
#include "access/gin.h"
+#include "hstore.h"
+
+
#define KEYFLAG 'K'
#define VALFLAG 'V'
#define NULLFLAG 'N'
diff --git a/contrib/hstore/hstore_gist.c b/contrib/hstore/hstore_gist.c
index 15ac965991..dc9405cb10 100644
--- a/contrib/hstore/hstore_gist.c
+++ b/contrib/hstore/hstore_gist.c
@@ -1,9 +1,15 @@
-#include "hstore.h"
+/*
+ * $PostgreSQL$
+ */
+#include "postgres.h"
#include "access/gist.h"
#include "access/itup.h"
+#include "access/skey.h"
#include "crc32.h"
+#include "hstore.h"
+
/* bigint defines */
#define BITBYTE 8
#define SIGLENINT 4 /* >122 => key will toast, so very slow!!! */
diff --git a/contrib/hstore/hstore_io.c b/contrib/hstore/hstore_io.c
index 6a395a2b86..faf24d97c6 100644
--- a/contrib/hstore/hstore_io.c
+++ b/contrib/hstore/hstore_io.c
@@ -1,6 +1,12 @@
-#include "hstore.h"
+/*
+ * $PostgreSQL$
+ */
+#include "postgres.h"
+
#include <ctype.h>
+#include "hstore.h"
+
PG_MODULE_MAGIC;
typedef struct
diff --git a/contrib/hstore/hstore_op.c b/contrib/hstore/hstore_op.c
index 961abfe35c..4f285ee633 100644
--- a/contrib/hstore/hstore_op.c
+++ b/contrib/hstore/hstore_op.c
@@ -1,9 +1,14 @@
-#include "hstore.h"
-#include "utils/array.h"
+/*
+ * $PostgreSQL
+ */
+#include "postgres.h"
+
#include "catalog/pg_type.h"
#include "funcapi.h"
-#include <access/heapam.h>
-#include <fmgr.h>
+#include "utils/array.h"
+#include "utils/builtins.h"
+
+#include "hstore.h"
static HEntry *
diff --git a/contrib/intagg/int_aggregate.c b/contrib/intagg/int_aggregate.c
index b32f674599..6f85eac0dc 100644
--- a/contrib/intagg/int_aggregate.c
+++ b/contrib/intagg/int_aggregate.c
@@ -19,8 +19,6 @@
#include <ctype.h>
#include <sys/types.h>
-#include "access/heapam.h"
-#include "access/tupmacs.h"
#include "access/xact.h"
#include "catalog/indexing.h"
#include "catalog/pg_proc.h"
diff --git a/contrib/intarray/_int.h b/contrib/intarray/_int.h
index 0a1888da3b..6a9bccb525 100644
--- a/contrib/intarray/_int.h
+++ b/contrib/intarray/_int.h
@@ -1,18 +1,7 @@
#ifndef ___INT_H__
#define ___INT_H__
-#include "postgres.h"
-
-#include <float.h>
-
-#include "access/gist.h"
-#include "access/itup.h"
-#include "access/skey.h"
-#include "catalog/pg_type.h"
#include "utils/array.h"
-#include "utils/builtins.h"
-#include "storage/bufpage.h"
-#include "lib/stringinfo.h"
/* number ranges for compression */
#define MAXNUMRANGE 100
@@ -173,4 +162,4 @@ if (ARRNELEMS(a) > 1) \
qsort((void*)ARRPTR(a), ARRNELEMS(a),sizeof(int4), \
(direction) ? compASC : compDESC )
-#endif
+#endif /* ___INT_H__ */
diff --git a/contrib/intarray/_int_bool.c b/contrib/intarray/_int_bool.c
index ef9430901d..a9fc66c1ff 100644
--- a/contrib/intarray/_int_bool.c
+++ b/contrib/intarray/_int_bool.c
@@ -1,3 +1,7 @@
+#include "postgres.h"
+
+#include "utils/builtins.h"
+
#include "_int.h"
PG_FUNCTION_INFO_V1(bqarr_in);
diff --git a/contrib/intarray/_int_gin.c b/contrib/intarray/_int_gin.c
index 8b6e99edae..d895990318 100644
--- a/contrib/intarray/_int_gin.c
+++ b/contrib/intarray/_int_gin.c
@@ -1,3 +1,8 @@
+#include "postgres.h"
+
+#include "access/gist.h"
+#include "access/skey.h"
+
#include "_int.h"
PG_FUNCTION_INFO_V1(ginint4_queryextract);
diff --git a/contrib/intarray/_int_gist.c b/contrib/intarray/_int_gist.c
index 37c05784b9..8f8f79a824 100644
--- a/contrib/intarray/_int_gist.c
+++ b/contrib/intarray/_int_gist.c
@@ -1,3 +1,8 @@
+#include "postgres.h"
+
+#include "access/gist.h"
+#include "access/skey.h"
+
#include "_int.h"
#define GETENTRY(vec,pos) ((ArrayType *) DatumGetPointer((vec)->vector[(pos)].key))
diff --git a/contrib/intarray/_int_op.c b/contrib/intarray/_int_op.c
index 40650b6af8..dd3b028929 100644
--- a/contrib/intarray/_int_op.c
+++ b/contrib/intarray/_int_op.c
@@ -1,7 +1,10 @@
-#include "_int.h"
+#include "postgres.h"
#include "lib/stringinfo.h"
+#include "_int.h"
+
+
PG_MODULE_MAGIC;
PG_FUNCTION_INFO_V1(_int_different);
diff --git a/contrib/intarray/_int_tool.c b/contrib/intarray/_int_tool.c
index fead4ff30d..82ab490784 100644
--- a/contrib/intarray/_int_tool.c
+++ b/contrib/intarray/_int_tool.c
@@ -1,3 +1,7 @@
+#include "postgres.h"
+
+#include "catalog/pg_type.h"
+
#include "_int.h"
diff --git a/contrib/intarray/_intbig_gist.c b/contrib/intarray/_intbig_gist.c
index b96c6d7289..fe83860cfa 100644
--- a/contrib/intarray/_intbig_gist.c
+++ b/contrib/intarray/_intbig_gist.c
@@ -1,3 +1,8 @@
+#include "postgres.h"
+
+#include "access/gist.h"
+#include "access/skey.h"
+
#include "_int.h"
#define GETENTRY(vec,pos) ((GISTTYPE *) DatumGetPointer((vec)->vector[(pos)].key))
diff --git a/contrib/ltree/_ltree_gist.c b/contrib/ltree/_ltree_gist.c
index 1c9b6b03ea..f1fa0fbaf4 100644
--- a/contrib/ltree/_ltree_gist.c
+++ b/contrib/ltree/_ltree_gist.c
@@ -2,13 +2,14 @@
* GiST support for ltree[]
* Teodor Sigaev <[email protected]>
*/
+#include "postgres.h"
-#include "ltree.h"
#include "access/gist.h"
#include "access/skey.h"
#include "utils/array.h"
-
#include "crc32.h"
+#include "ltree.h"
+
PG_FUNCTION_INFO_V1(_ltree_compress);
Datum _ltree_compress(PG_FUNCTION_ARGS);
diff --git a/contrib/ltree/_ltree_op.c b/contrib/ltree/_ltree_op.c
index f93d2bb888..4a648ee03e 100644
--- a/contrib/ltree/_ltree_op.c
+++ b/contrib/ltree/_ltree_op.c
@@ -2,10 +2,12 @@
* op function for ltree[]
* Teodor Sigaev <[email protected]>
*/
+#include "postgres.h"
-#include "ltree.h"
#include <ctype.h>
+
#include "utils/array.h"
+#include "ltree.h"
PG_FUNCTION_INFO_V1(_ltree_isparent);
PG_FUNCTION_INFO_V1(_ltree_r_isparent);
diff --git a/contrib/ltree/lquery_op.c b/contrib/ltree/lquery_op.c
index 3bc6520816..51d372cdba 100644
--- a/contrib/ltree/lquery_op.c
+++ b/contrib/ltree/lquery_op.c
@@ -3,10 +3,12 @@
* Teodor Sigaev <[email protected]>
* $PostgreSQL$
*/
+#include "postgres.h"
-#include "ltree.h"
#include <ctype.h>
+
#include "utils/array.h"
+#include "ltree.h"
PG_FUNCTION_INFO_V1(ltq_regex);
PG_FUNCTION_INFO_V1(ltq_rregex);
diff --git a/contrib/ltree/ltree.h b/contrib/ltree/ltree.h
index 6117644222..8d39c9ec39 100644
--- a/contrib/ltree/ltree.h
+++ b/contrib/ltree/ltree.h
@@ -3,9 +3,7 @@
#ifndef __LTREE_H__
#define __LTREE_H__
-#include "postgres.h"
-
-#include "utils/builtins.h"
+#include "fmgr.h"
typedef struct
{
diff --git a/contrib/ltree/ltree_gist.c b/contrib/ltree/ltree_gist.c
index 72ce30818f..9c9e997741 100644
--- a/contrib/ltree/ltree_gist.c
+++ b/contrib/ltree/ltree_gist.c
@@ -3,13 +3,14 @@
* Teodor Sigaev <[email protected]>
* $PostgreSQL$
*/
+#include "postgres.h"
-#include "ltree.h"
#include "access/gist.h"
#include "access/nbtree.h"
#include "access/skey.h"
#include "utils/array.h"
#include "crc32.h"
+#include "ltree.h"
#define NEXTVAL(x) ( (lquery*)( (char*)(x) + INTALIGN( VARSIZE(x) ) ) )
diff --git a/contrib/ltree/ltree_io.c b/contrib/ltree/ltree_io.c
index d534a89690..bd50105487 100644
--- a/contrib/ltree/ltree_io.c
+++ b/contrib/ltree/ltree_io.c
@@ -3,9 +3,11 @@
* Teodor Sigaev <[email protected]>
* $PostgreSQL$
*/
+#include "postgres.h"
-#include "ltree.h"
#include <ctype.h>
+
+#include "ltree.h"
#include "crc32.h"
PG_FUNCTION_INFO_V1(ltree_in);
diff --git a/contrib/ltree/ltree_op.c b/contrib/ltree/ltree_op.c
index 84b86189e4..af37070067 100644
--- a/contrib/ltree/ltree_op.c
+++ b/contrib/ltree/ltree_op.c
@@ -3,15 +3,16 @@
* Teodor Sigaev <[email protected]>
* $PostgreSQL$
*/
-
-#include "ltree.h"
+#include "postgres.h"
#include <ctype.h>
#include "catalog/pg_statistic.h"
+#include "utils/builtins.h"
#include "utils/lsyscache.h"
#include "utils/selfuncs.h"
#include "utils/syscache.h"
+#include "ltree.h"
PG_MODULE_MAGIC;
diff --git a/contrib/ltree/ltxtquery_io.c b/contrib/ltree/ltxtquery_io.c
index c67ca52c70..340370810b 100644
--- a/contrib/ltree/ltxtquery_io.c
+++ b/contrib/ltree/ltxtquery_io.c
@@ -3,10 +3,12 @@
* Teodor Sigaev <[email protected]>
* $PostgreSQL$
*/
+#include "postgres.h"
-#include "ltree.h"
#include <ctype.h>
+
#include "crc32.h"
+#include "ltree.h"
PG_FUNCTION_INFO_V1(ltxtq_in);
Datum ltxtq_in(PG_FUNCTION_ARGS);
diff --git a/contrib/ltree/ltxtquery_op.c b/contrib/ltree/ltxtquery_op.c
index 4e3b92a53b..3e73005e12 100644
--- a/contrib/ltree/ltxtquery_op.c
+++ b/contrib/ltree/ltxtquery_op.c
@@ -3,10 +3,12 @@
* Teodor Sigaev <[email protected]>
* $PostgreSQL$
*/
+#include "postgres.h"
-#include "ltree.h"
#include <ctype.h>
+#include "ltree.h"
+
PG_FUNCTION_INFO_V1(ltxtq_exec);
PG_FUNCTION_INFO_V1(ltxtq_rexec);
diff --git a/contrib/pageinspect/btreefuncs.c b/contrib/pageinspect/btreefuncs.c
index ce8b97e46b..3fbfb9c12b 100644
--- a/contrib/pageinspect/btreefuncs.c
+++ b/contrib/pageinspect/btreefuncs.c
@@ -30,6 +30,7 @@
#include "catalog/pg_type.h"
#include "funcapi.h"
#include "miscadmin.h"
+#include "storage/bufmgr.h"
#include "utils/builtins.h"
diff --git a/contrib/pageinspect/rawpage.c b/contrib/pageinspect/rawpage.c
index 0ad83661f3..a616b57b4b 100644
--- a/contrib/pageinspect/rawpage.c
+++ b/contrib/pageinspect/rawpage.c
@@ -15,14 +15,15 @@
#include "postgres.h"
-#include "fmgr.h"
-#include "funcapi.h"
#include "access/heapam.h"
#include "access/transam.h"
#include "catalog/namespace.h"
#include "catalog/pg_type.h"
-#include "utils/builtins.h"
+#include "fmgr.h"
+#include "funcapi.h"
#include "miscadmin.h"
+#include "storage/bufmgr.h"
+#include "utils/builtins.h"
PG_MODULE_MAGIC;
diff --git a/contrib/pg_freespacemap/pg_freespacemap.c b/contrib/pg_freespacemap/pg_freespacemap.c
index f17ffbaf20..bebea97da4 100644
--- a/contrib/pg_freespacemap/pg_freespacemap.c
+++ b/contrib/pg_freespacemap/pg_freespacemap.c
@@ -8,10 +8,11 @@
*/
#include "postgres.h"
-#include "funcapi.h"
-#include "access/heapam.h"
+#include "access/htup.h"
#include "catalog/pg_type.h"
+#include "funcapi.h"
#include "storage/freespace.h"
+#include "storage/lmgr.h"
#define NUM_FREESPACE_PAGES_ELEM 5
diff --git a/contrib/pgrowlocks/pgrowlocks.c b/contrib/pgrowlocks/pgrowlocks.c
index b2279be209..5633c24693 100644
--- a/contrib/pgrowlocks/pgrowlocks.c
+++ b/contrib/pgrowlocks/pgrowlocks.c
@@ -30,6 +30,7 @@
#include "catalog/namespace.h"
#include "funcapi.h"
#include "miscadmin.h"
+#include "storage/bufmgr.h"
#include "storage/procarray.h"
#include "utils/acl.h"
#include "utils/builtins.h"
diff --git a/contrib/pgstattuple/pgstatindex.c b/contrib/pgstattuple/pgstatindex.c
index 08200fafae..7b95a070b4 100644
--- a/contrib/pgstattuple/pgstatindex.c
+++ b/contrib/pgstattuple/pgstatindex.c
@@ -29,6 +29,7 @@
#include "catalog/namespace.h"
#include "funcapi.h"
#include "miscadmin.h"
+#include "storage/bufmgr.h"
#include "utils/builtins.h"
diff --git a/contrib/pgstattuple/pgstattuple.c b/contrib/pgstattuple/pgstattuple.c
index addcda352e..31dbd30277 100644
--- a/contrib/pgstattuple/pgstattuple.c
+++ b/contrib/pgstattuple/pgstattuple.c
@@ -27,10 +27,12 @@
#include "access/gist_private.h"
#include "access/hash.h"
#include "access/heapam.h"
+#include "access/htup.h"
#include "access/nbtree.h"
#include "catalog/namespace.h"
#include "funcapi.h"
#include "miscadmin.h"
+#include "storage/bufmgr.h"
#include "utils/builtins.h"
#include "utils/tqual.h"
diff --git a/src/backend/access/common/heaptuple.c b/src/backend/access/common/heaptuple.c
index f156a64d3d..f27ce02e6e 100644
--- a/src/backend/access/common/heaptuple.c
+++ b/src/backend/access/common/heaptuple.c
@@ -65,6 +65,7 @@
#include "postgres.h"
#include "access/heapam.h"
+#include "access/sysattr.h"
#include "access/tuptoaster.h"
#include "executor/tuptable.h"
diff --git a/src/backend/access/gin/ginbtree.c b/src/backend/access/gin/ginbtree.c
index cb2bdef3b4..910f9b6a75 100644
--- a/src/backend/access/gin/ginbtree.c
+++ b/src/backend/access/gin/ginbtree.c
@@ -13,8 +13,10 @@
*/
#include "postgres.h"
+
#include "access/gin.h"
#include "miscadmin.h"
+#include "storage/bufmgr.h"
/*
* Locks buffer by needed method for search.
diff --git a/src/backend/access/gin/gindatapage.c b/src/backend/access/gin/gindatapage.c
index f7f683ac30..38316331e6 100644
--- a/src/backend/access/gin/gindatapage.c
+++ b/src/backend/access/gin/gindatapage.c
@@ -13,7 +13,9 @@
*/
#include "postgres.h"
+
#include "access/gin.h"
+#include "storage/bufmgr.h"
int
compareItemPointers(ItemPointer a, ItemPointer b)
diff --git a/src/backend/access/gin/ginentrypage.c b/src/backend/access/gin/ginentrypage.c
index 8630a6881a..861b4c138a 100644
--- a/src/backend/access/gin/ginentrypage.c
+++ b/src/backend/access/gin/ginentrypage.c
@@ -15,6 +15,7 @@
#include "postgres.h"
#include "access/gin.h"
#include "access/tuptoaster.h"
+#include "storage/bufmgr.h"
/*
* forms tuple for entry tree. On leaf page, Index tuple has
diff --git a/src/backend/access/gin/ginget.c b/src/backend/access/gin/ginget.c
index aa51b9f052..4f54157bca 100644
--- a/src/backend/access/gin/ginget.c
+++ b/src/backend/access/gin/ginget.c
@@ -17,6 +17,7 @@
#include "access/gin.h"
#include "catalog/index.h"
#include "miscadmin.h"
+#include "storage/bufmgr.h"
#include "utils/memutils.h"
static bool
diff --git a/src/backend/access/gin/gininsert.c b/src/backend/access/gin/gininsert.c
index 4bbf3f0498..6fa07caf5a 100644
--- a/src/backend/access/gin/gininsert.c
+++ b/src/backend/access/gin/gininsert.c
@@ -18,6 +18,7 @@
#include "access/gin.h"
#include "catalog/index.h"
#include "miscadmin.h"
+#include "storage/bufmgr.h"
#include "utils/memutils.h"
diff --git a/src/backend/access/gin/ginscan.c b/src/backend/access/gin/ginscan.c
index 5f28db5926..f43a52e4fe 100644
--- a/src/backend/access/gin/ginscan.c
+++ b/src/backend/access/gin/ginscan.c
@@ -13,9 +13,11 @@
*/
#include "postgres.h"
+
#include "access/genam.h"
#include "access/gin.h"
#include "pgstat.h"
+#include "storage/bufmgr.h"
#include "utils/memutils.h"
diff --git a/src/backend/access/gin/ginutil.c b/src/backend/access/gin/ginutil.c
index 3443b51de6..3b3426bd29 100644
--- a/src/backend/access/gin/ginutil.c
+++ b/src/backend/access/gin/ginutil.c
@@ -15,9 +15,10 @@
#include "postgres.h"
#include "access/genam.h"
#include "access/gin.h"
-#include "access/heapam.h"
#include "access/reloptions.h"
+#include "storage/bufmgr.h"
#include "storage/freespace.h"
+#include "storage/lmgr.h"
void
initGinState(GinState *state, Relation index)
diff --git a/src/backend/access/gin/ginvacuum.c b/src/backend/access/gin/ginvacuum.c
index e0bbe32963..fbd2b45c05 100644
--- a/src/backend/access/gin/ginvacuum.c
+++ b/src/backend/access/gin/ginvacuum.c
@@ -13,13 +13,14 @@
*/
#include "postgres.h"
+
#include "access/genam.h"
#include "access/gin.h"
-#include "access/heapam.h"
+#include "commands/vacuum.h"
#include "miscadmin.h"
+#include "storage/bufmgr.h"
#include "storage/freespace.h"
-#include "storage/freespace.h"
-#include "commands/vacuum.h"
+#include "storage/lmgr.h"
typedef struct
{
diff --git a/src/backend/access/gin/ginxlog.c b/src/backend/access/gin/ginxlog.c
index 4f631fb57b..d3dd8d69b1 100644
--- a/src/backend/access/gin/ginxlog.c
+++ b/src/backend/access/gin/ginxlog.c
@@ -14,7 +14,8 @@
#include "postgres.h"
#include "access/gin.h"
-#include "access/heapam.h"
+#include "access/xlogutils.h"
+#include "storage/bufmgr.h"
#include "utils/memutils.h"
static MemoryContext opCtx; /* working memory for operations */
diff --git a/src/backend/access/gist/gist.c b/src/backend/access/gist/gist.c
index 615bd8fd35..77ff12ddcf 100644
--- a/src/backend/access/gist/gist.c
+++ b/src/backend/access/gist/gist.c
@@ -18,6 +18,7 @@
#include "access/gist_private.h"
#include "catalog/index.h"
#include "miscadmin.h"
+#include "storage/bufmgr.h"
#include "utils/memutils.h"
const XLogRecPtr XLogRecPtrForTemp = {1, 1};
diff --git a/src/backend/access/gist/gistget.c b/src/backend/access/gist/gistget.c
index df0e80e4f7..5ace610311 100644
--- a/src/backend/access/gist/gistget.c
+++ b/src/backend/access/gist/gistget.c
@@ -18,6 +18,7 @@
#include "executor/execdebug.h"
#include "miscadmin.h"
#include "pgstat.h"
+#include "storage/bufmgr.h"
#include "utils/memutils.h"
diff --git a/src/backend/access/gist/gistscan.c b/src/backend/access/gist/gistscan.c
index 90eaf11bf1..dfd7ca6eec 100644
--- a/src/backend/access/gist/gistscan.c
+++ b/src/backend/access/gist/gistscan.c
@@ -17,6 +17,7 @@
#include "access/genam.h"
#include "access/gist_private.h"
#include "access/gistscan.h"
+#include "storage/bufmgr.h"
#include "utils/memutils.h"
static void gistfreestack(GISTSearchStack *s);
diff --git a/src/backend/access/gist/gistutil.c b/src/backend/access/gist/gistutil.c
index e340731222..a66ea9e6be 100644
--- a/src/backend/access/gist/gistutil.c
+++ b/src/backend/access/gist/gistutil.c
@@ -14,9 +14,10 @@
#include "postgres.h"
#include "access/gist_private.h"
-#include "access/heapam.h"
#include "access/reloptions.h"
#include "storage/freespace.h"
+#include "storage/lmgr.h"
+#include "storage/bufmgr.h"
/*
* static *S used for temrorary storage (saves stack and palloc() call)
diff --git a/src/backend/access/gist/gistvacuum.c b/src/backend/access/gist/gistvacuum.c
index f495c2f699..a5b70af67b 100644
--- a/src/backend/access/gist/gistvacuum.c
+++ b/src/backend/access/gist/gistvacuum.c
@@ -16,10 +16,11 @@
#include "access/genam.h"
#include "access/gist_private.h"
-#include "access/heapam.h"
#include "commands/vacuum.h"
#include "miscadmin.h"
+#include "storage/bufmgr.h"
#include "storage/freespace.h"
+#include "storage/lmgr.h"
#include "utils/memutils.h"
diff --git a/src/backend/access/gist/gistxlog.c b/src/backend/access/gist/gistxlog.c
index adf203d458..81bb7c59ff 100644
--- a/src/backend/access/gist/gistxlog.c
+++ b/src/backend/access/gist/gistxlog.c
@@ -14,8 +14,9 @@
#include "postgres.h"
#include "access/gist_private.h"
-#include "access/heapam.h"
+#include "access/xlogutils.h"
#include "miscadmin.h"
+#include "storage/bufmgr.h"
#include "utils/memutils.h"
diff --git a/src/backend/access/hash/hash.c b/src/backend/access/hash/hash.c
index c0ca636bcd..f794e6d9ac 100644
--- a/src/backend/access/hash/hash.c
+++ b/src/backend/access/hash/hash.c
@@ -25,6 +25,7 @@
#include "miscadmin.h"
#include "optimizer/cost.h"
#include "optimizer/plancat.h"
+#include "storage/bufmgr.h"
/* Working state for hashbuild and its callback */
diff --git a/src/backend/access/hash/hashinsert.c b/src/backend/access/hash/hashinsert.c
index 6eaafbba8e..6779980224 100644
--- a/src/backend/access/hash/hashinsert.c
+++ b/src/backend/access/hash/hashinsert.c
@@ -16,6 +16,7 @@
#include "postgres.h"
#include "access/hash.h"
+#include "storage/bufmgr.h"
static OffsetNumber _hash_pgaddtup(Relation rel, Buffer buf,
diff --git a/src/backend/access/hash/hashovfl.c b/src/backend/access/hash/hashovfl.c
index e39cd68d73..c8c6f0c364 100644
--- a/src/backend/access/hash/hashovfl.c
+++ b/src/backend/access/hash/hashovfl.c
@@ -18,6 +18,7 @@
#include "postgres.h"
#include "access/hash.h"
+#include "storage/bufmgr.h"
static Buffer _hash_getovflpage(Relation rel, Buffer metabuf);
diff --git a/src/backend/access/hash/hashpage.c b/src/backend/access/hash/hashpage.c
index 2bca0368ed..b0b58743e0 100644
--- a/src/backend/access/hash/hashpage.c
+++ b/src/backend/access/hash/hashpage.c
@@ -31,6 +31,7 @@
#include "access/genam.h"
#include "access/hash.h"
#include "miscadmin.h"
+#include "storage/bufmgr.h"
#include "storage/lmgr.h"
#include "storage/smgr.h"
#include "utils/lsyscache.h"
diff --git a/src/backend/access/hash/hashsearch.c b/src/backend/access/hash/hashsearch.c
index 5d710f59e8..648408c06e 100644
--- a/src/backend/access/hash/hashsearch.c
+++ b/src/backend/access/hash/hashsearch.c
@@ -16,6 +16,7 @@
#include "access/hash.h"
#include "pgstat.h"
+#include "storage/bufmgr.h"
/*
diff --git a/src/backend/access/hash/hashutil.c b/src/backend/access/hash/hashutil.c
index 0839b04ad1..637d23fc63 100644
--- a/src/backend/access/hash/hashutil.c
+++ b/src/backend/access/hash/hashutil.c
@@ -18,6 +18,7 @@
#include "access/hash.h"
#include "access/reloptions.h"
#include "executor/execdebug.h"
+#include "storage/bufmgr.h"
#include "utils/lsyscache.h"
diff --git a/src/backend/access/heap/heapam.c b/src/backend/access/heap/heapam.c
index cf19dab451..6c20b48cc4 100644
--- a/src/backend/access/heap/heapam.c
+++ b/src/backend/access/heap/heapam.c
@@ -42,14 +42,18 @@
#include "access/heapam.h"
#include "access/hio.h"
#include "access/multixact.h"
+#include "access/sysattr.h"
#include "access/transam.h"
#include "access/tuptoaster.h"
#include "access/valid.h"
#include "access/xact.h"
+#include "access/xlogutils.h"
#include "catalog/catalog.h"
#include "catalog/namespace.h"
#include "miscadmin.h"
#include "pgstat.h"
+#include "storage/bufmgr.h"
+#include "storage/lmgr.h"
#include "storage/procarray.h"
#include "storage/smgr.h"
#include "utils/datum.h"
diff --git a/src/backend/access/heap/hio.c b/src/backend/access/heap/hio.c
index db31906c10..2464c5ba6a 100644
--- a/src/backend/access/heap/hio.c
+++ b/src/backend/access/heap/hio.c
@@ -15,9 +15,11 @@
#include "postgres.h"
-#include "access/heapam.h"
#include "access/hio.h"
+#include "storage/bufmgr.h"
+#include "storage/bufpage.h"
#include "storage/freespace.h"
+#include "storage/lmgr.h"
/*
diff --git a/src/backend/access/heap/pruneheap.c b/src/backend/access/heap/pruneheap.c
index c6741b3d03..b91f9b7bac 100644
--- a/src/backend/access/heap/pruneheap.c
+++ b/src/backend/access/heap/pruneheap.c
@@ -15,9 +15,13 @@
#include "postgres.h"
#include "access/heapam.h"
+#include "access/htup.h"
#include "access/transam.h"
#include "miscadmin.h"
#include "pgstat.h"
+#include "storage/bufmgr.h"
+#include "storage/bufpage.h"
+#include "storage/off.h"
#include "utils/inval.h"
#include "utils/tqual.h"
diff --git a/src/backend/access/heap/rewriteheap.c b/src/backend/access/heap/rewriteheap.c
index 775c4e23bd..22cd90d1a6 100644
--- a/src/backend/access/heap/rewriteheap.c
+++ b/src/backend/access/heap/rewriteheap.c
@@ -106,6 +106,7 @@
#include "access/rewriteheap.h"
#include "access/transam.h"
#include "access/tuptoaster.h"
+#include "storage/bufmgr.h"
#include "storage/smgr.h"
#include "utils/memutils.h"
diff --git a/src/backend/access/heap/syncscan.c b/src/backend/access/heap/syncscan.c
index f8a3282e24..dfc7265adf 100644
--- a/src/backend/access/heap/syncscan.c
+++ b/src/backend/access/heap/syncscan.c
@@ -48,6 +48,9 @@
#include "access/heapam.h"
#include "miscadmin.h"
+#include "storage/block.h"
+#include "storage/relfilenode.h"
+#include "utils/rel.h"
/* GUC variables */
diff --git a/src/backend/access/index/indexam.c b/src/backend/access/index/indexam.c
index 7ef02fb94e..2bf97039e6 100644
--- a/src/backend/access/index/indexam.c
+++ b/src/backend/access/index/indexam.c
@@ -66,6 +66,8 @@
#include "access/heapam.h"
#include "access/transam.h"
#include "pgstat.h"
+#include "storage/bufmgr.h"
+#include "storage/lmgr.h"
#include "utils/relcache.h"
#include "utils/snapmgr.h"
#include "utils/tqual.h"
diff --git a/src/backend/access/nbtree/nbtinsert.c b/src/backend/access/nbtree/nbtinsert.c
index bfdf50cf2a..15d4f4306d 100644
--- a/src/backend/access/nbtree/nbtinsert.c
+++ b/src/backend/access/nbtree/nbtinsert.c
@@ -19,6 +19,8 @@
#include "access/nbtree.h"
#include "access/transam.h"
#include "miscadmin.h"
+#include "storage/bufmgr.h"
+#include "storage/lmgr.h"
#include "utils/inval.h"
#include "utils/tqual.h"
diff --git a/src/backend/access/nbtree/nbtpage.c b/src/backend/access/nbtree/nbtpage.c
index ccb1fd9dea..e7ffa5311f 100644
--- a/src/backend/access/nbtree/nbtpage.c
+++ b/src/backend/access/nbtree/nbtpage.c
@@ -25,6 +25,7 @@
#include "access/nbtree.h"
#include "access/transam.h"
#include "miscadmin.h"
+#include "storage/bufmgr.h"
#include "storage/freespace.h"
#include "storage/lmgr.h"
#include "utils/inval.h"
diff --git a/src/backend/access/nbtree/nbtree.c b/src/backend/access/nbtree/nbtree.c
index 36ed781729..21768f0a2d 100644
--- a/src/backend/access/nbtree/nbtree.c
+++ b/src/backend/access/nbtree/nbtree.c
@@ -23,6 +23,7 @@
#include "catalog/index.h"
#include "commands/vacuum.h"
#include "miscadmin.h"
+#include "storage/bufmgr.h"
#include "storage/freespace.h"
#include "storage/ipc.h"
#include "storage/lmgr.h"
diff --git a/src/backend/access/nbtree/nbtsearch.c b/src/backend/access/nbtree/nbtsearch.c
index c7bd41db41..1761908470 100644
--- a/src/backend/access/nbtree/nbtsearch.c
+++ b/src/backend/access/nbtree/nbtsearch.c
@@ -18,6 +18,7 @@
#include "access/genam.h"
#include "access/nbtree.h"
#include "pgstat.h"
+#include "storage/bufmgr.h"
#include "utils/lsyscache.h"
diff --git a/src/backend/access/nbtree/nbtutils.c b/src/backend/access/nbtree/nbtutils.c
index b477bdc021..0419b68c7e 100644
--- a/src/backend/access/nbtree/nbtutils.c
+++ b/src/backend/access/nbtree/nbtutils.c
@@ -22,6 +22,7 @@
#include "access/reloptions.h"
#include "executor/execdebug.h"
#include "miscadmin.h"
+#include "storage/bufmgr.h"
#include "storage/lwlock.h"
#include "storage/shmem.h"
#include "utils/lsyscache.h"
diff --git a/src/backend/access/nbtree/nbtxlog.c b/src/backend/access/nbtree/nbtxlog.c
index 08c188827c..d56f73cb6d 100644
--- a/src/backend/access/nbtree/nbtxlog.c
+++ b/src/backend/access/nbtree/nbtxlog.c
@@ -16,6 +16,7 @@
#include "access/nbtree.h"
#include "access/transam.h"
+#include "storage/bufmgr.h"
/*
* We must keep track of expected insertions due to page splits, and apply
diff --git a/src/backend/access/transam/twophase.c b/src/backend/access/transam/twophase.c
index 4dac095076..63c06c04bf 100644
--- a/src/backend/access/transam/twophase.c
+++ b/src/backend/access/transam/twophase.c
@@ -42,7 +42,7 @@
#include <time.h>
#include <unistd.h>
-#include "access/heapam.h"
+#include "access/htup.h"
#include "access/subtrans.h"
#include "access/transam.h"
#include "access/twophase.h"
diff --git a/src/backend/access/transam/xact.c b/src/backend/access/transam/xact.c
index 1a43e8d8d4..a7886dcc8c 100644
--- a/src/backend/access/transam/xact.c
+++ b/src/backend/access/transam/xact.c
@@ -34,6 +34,7 @@
#include "libpq/be-fsstubs.h"
#include "miscadmin.h"
#include "pgstat.h"
+#include "storage/bufmgr.h"
#include "storage/fd.h"
#include "storage/lmgr.h"
#include "storage/procarray.h"
diff --git a/src/backend/access/transam/xlog.c b/src/backend/access/transam/xlog.c
index e5b7ccde37..22559823c8 100644
--- a/src/backend/access/transam/xlog.c
+++ b/src/backend/access/transam/xlog.c
@@ -24,7 +24,6 @@
#include <unistd.h>
#include "access/clog.h"
-#include "access/heapam.h"
#include "access/multixact.h"
#include "access/subtrans.h"
#include "access/transam.h"
@@ -41,6 +40,7 @@
#include "miscadmin.h"
#include "pgstat.h"
#include "postmaster/bgwriter.h"
+#include "storage/bufmgr.h"
#include "storage/bufpage.h"
#include "storage/fd.h"
#include "storage/ipc.h"
diff --git a/src/backend/access/transam/xlogutils.c b/src/backend/access/transam/xlogutils.c
index 1561d4ce2e..fd5e51280e 100644
--- a/src/backend/access/transam/xlogutils.c
+++ b/src/backend/access/transam/xlogutils.c
@@ -18,6 +18,7 @@
#include "postgres.h"
#include "access/xlogutils.h"
+#include "storage/bufmgr.h"
#include "storage/bufpage.h"
#include "storage/smgr.h"
#include "utils/hsearch.h"
diff --git a/src/backend/bootstrap/bootstrap.c b/src/backend/bootstrap/bootstrap.c
index 50f8cb2220..14cb38558d 100644
--- a/src/backend/bootstrap/bootstrap.c
+++ b/src/backend/bootstrap/bootstrap.c
@@ -32,6 +32,7 @@
#include "nodes/makefuncs.h"
#include "postmaster/bgwriter.h"
#include "postmaster/walwriter.h"
+#include "storage/bufmgr.h"
#include "storage/freespace.h"
#include "storage/ipc.h"
#include "storage/proc.h"
diff --git a/src/backend/catalog/aclchk.c b/src/backend/catalog/aclchk.c
index dc9b49f283..dc6ddece7b 100644
--- a/src/backend/catalog/aclchk.c
+++ b/src/backend/catalog/aclchk.c
@@ -19,6 +19,7 @@
#include "access/genam.h"
#include "access/heapam.h"
+#include "access/sysattr.h"
#include "access/xact.h"
#include "catalog/catalog.h"
#include "catalog/dependency.h"
diff --git a/src/backend/catalog/catalog.c b/src/backend/catalog/catalog.c
index cd0d9e232c..cc34dd96d0 100644
--- a/src/backend/catalog/catalog.c
+++ b/src/backend/catalog/catalog.c
@@ -21,6 +21,7 @@
#include <unistd.h>
#include "access/genam.h"
+#include "access/sysattr.h"
#include "access/transam.h"
#include "catalog/catalog.h"
#include "catalog/indexing.h"
diff --git a/src/backend/catalog/dependency.c b/src/backend/catalog/dependency.c
index f60bea3c87..603564ae36 100644
--- a/src/backend/catalog/dependency.c
+++ b/src/backend/catalog/dependency.c
@@ -16,6 +16,7 @@
#include "access/genam.h"
#include "access/heapam.h"
+#include "access/sysattr.h"
#include "access/xact.h"
#include "catalog/dependency.h"
#include "catalog/heap.h"
diff --git a/src/backend/catalog/heap.c b/src/backend/catalog/heap.c
index 070bebc943..6b7fdbcebd 100644
--- a/src/backend/catalog/heap.c
+++ b/src/backend/catalog/heap.c
@@ -31,6 +31,7 @@
#include "access/genam.h"
#include "access/heapam.h"
+#include "access/sysattr.h"
#include "access/transam.h"
#include "access/xact.h"
#include "catalog/catalog.h"
@@ -54,6 +55,7 @@
#include "parser/parse_coerce.h"
#include "parser/parse_expr.h"
#include "parser/parse_relation.h"
+#include "storage/bufmgr.h"
#include "storage/smgr.h"
#include "utils/builtins.h"
#include "utils/fmgroids.h"
diff --git a/src/backend/catalog/index.c b/src/backend/catalog/index.c
index 6db3084ead..f770bfbbc5 100644
--- a/src/backend/catalog/index.c
+++ b/src/backend/catalog/index.c
@@ -25,6 +25,7 @@
#include "access/genam.h"
#include "access/heapam.h"
+#include "access/sysattr.h"
#include "access/transam.h"
#include "access/xact.h"
#include "bootstrap/bootstrap.h"
@@ -45,6 +46,8 @@
#include "optimizer/clauses.h"
#include "optimizer/var.h"
#include "parser/parse_expr.h"
+#include "storage/bufmgr.h"
+#include "storage/lmgr.h"
#include "storage/procarray.h"
#include "storage/smgr.h"
#include "utils/builtins.h"
diff --git a/src/backend/catalog/pg_conversion.c b/src/backend/catalog/pg_conversion.c
index 42a3de5b7f..5a5888e5da 100644
--- a/src/backend/catalog/pg_conversion.c
+++ b/src/backend/catalog/pg_conversion.c
@@ -15,6 +15,7 @@
#include "postgres.h"
#include "access/heapam.h"
+#include "access/sysattr.h"
#include "catalog/dependency.h"
#include "catalog/indexing.h"
#include "catalog/namespace.h"
diff --git a/src/backend/catalog/pg_shdepend.c b/src/backend/catalog/pg_shdepend.c
index 62830de6e1..9fb0b0c9ef 100644
--- a/src/backend/catalog/pg_shdepend.c
+++ b/src/backend/catalog/pg_shdepend.c
@@ -36,6 +36,7 @@
#include "commands/schemacmds.h"
#include "commands/tablecmds.h"
#include "commands/typecmds.h"
+#include "storage/lmgr.h"
#include "miscadmin.h"
#include "utils/acl.h"
#include "utils/fmgroids.h"
diff --git a/src/backend/commands/analyze.c b/src/backend/commands/analyze.c
index c4d61a6100..1b2945ebd4 100644
--- a/src/backend/commands/analyze.c
+++ b/src/backend/commands/analyze.c
@@ -33,6 +33,7 @@
#include "parser/parse_relation.h"
#include "pgstat.h"
#include "postmaster/autovacuum.h"
+#include "storage/bufmgr.h"
#include "storage/proc.h"
#include "storage/procarray.h"
#include "utils/acl.h"
diff --git a/src/backend/commands/cluster.c b/src/backend/commands/cluster.c
index 1619cdde9d..e44a43db74 100644
--- a/src/backend/commands/cluster.c
+++ b/src/backend/commands/cluster.c
@@ -34,6 +34,7 @@
#include "commands/trigger.h"
#include "commands/vacuum.h"
#include "miscadmin.h"
+#include "storage/bufmgr.h"
#include "storage/procarray.h"
#include "utils/acl.h"
#include "utils/fmgroids.h"
diff --git a/src/backend/commands/dbcommands.c b/src/backend/commands/dbcommands.c
index fc3ebf6ff1..815524e4fc 100644
--- a/src/backend/commands/dbcommands.c
+++ b/src/backend/commands/dbcommands.c
@@ -27,6 +27,7 @@
#include "access/genam.h"
#include "access/heapam.h"
#include "access/xact.h"
+#include "access/xlogutils.h"
#include "catalog/catalog.h"
#include "catalog/dependency.h"
#include "catalog/indexing.h"
@@ -40,6 +41,8 @@
#include "miscadmin.h"
#include "pgstat.h"
#include "postmaster/bgwriter.h"
+#include "storage/bufmgr.h"
+#include "storage/lmgr.h"
#include "storage/freespace.h"
#include "storage/ipc.h"
#include "storage/procarray.h"
diff --git a/src/backend/commands/functioncmds.c b/src/backend/commands/functioncmds.c
index 942f64ebf6..639c5a6ded 100644
--- a/src/backend/commands/functioncmds.c
+++ b/src/backend/commands/functioncmds.c
@@ -34,6 +34,7 @@
#include "access/genam.h"
#include "access/heapam.h"
+#include "access/sysattr.h"
#include "catalog/dependency.h"
#include "catalog/indexing.h"
#include "catalog/pg_aggregate.h"
diff --git a/src/backend/commands/indexcmds.c b/src/backend/commands/indexcmds.c
index cdcd8d3ad7..6fc9a81146 100644
--- a/src/backend/commands/indexcmds.c
+++ b/src/backend/commands/indexcmds.c
@@ -38,6 +38,7 @@
#include "parser/parse_expr.h"
#include "parser/parse_func.h"
#include "parser/parsetree.h"
+#include "storage/lmgr.h"
#include "storage/proc.h"
#include "storage/procarray.h"
#include "utils/acl.h"
diff --git a/src/backend/commands/opclasscmds.c b/src/backend/commands/opclasscmds.c
index 4a18c568f6..dcd40e6f57 100644
--- a/src/backend/commands/opclasscmds.c
+++ b/src/backend/commands/opclasscmds.c
@@ -19,6 +19,7 @@
#include "access/genam.h"
#include "access/heapam.h"
+#include "access/sysattr.h"
#include "catalog/dependency.h"
#include "catalog/indexing.h"
#include "catalog/pg_amop.h"
diff --git a/src/backend/commands/prepare.c b/src/backend/commands/prepare.c
index ee83d01079..a523f585ec 100644
--- a/src/backend/commands/prepare.c
+++ b/src/backend/commands/prepare.c
@@ -16,7 +16,6 @@
*/
#include "postgres.h"
-#include "access/heapam.h"
#include "access/xact.h"
#include "catalog/pg_type.h"
#include "commands/explain.h"
diff --git a/src/backend/commands/sequence.c b/src/backend/commands/sequence.c
index b053754f21..69ec9e17ec 100644
--- a/src/backend/commands/sequence.c
+++ b/src/backend/commands/sequence.c
@@ -17,6 +17,7 @@
#include "access/heapam.h"
#include "access/transam.h"
#include "access/xact.h"
+#include "access/xlogutils.h"
#include "catalog/dependency.h"
#include "catalog/namespace.h"
#include "catalog/pg_type.h"
@@ -25,6 +26,8 @@
#include "commands/tablecmds.h"
#include "miscadmin.h"
#include "nodes/makefuncs.h"
+#include "storage/bufmgr.h"
+#include "storage/lmgr.h"
#include "storage/proc.h"
#include "utils/acl.h"
#include "utils/builtins.h"
diff --git a/src/backend/commands/tablecmds.c b/src/backend/commands/tablecmds.c
index 4702df2fbd..ab101baf46 100644
--- a/src/backend/commands/tablecmds.c
+++ b/src/backend/commands/tablecmds.c
@@ -17,6 +17,7 @@
#include "access/genam.h"
#include "access/heapam.h"
#include "access/reloptions.h"
+#include "access/sysattr.h"
#include "access/xact.h"
#include "catalog/catalog.h"
#include "catalog/dependency.h"
@@ -58,6 +59,7 @@
#include "parser/parser.h"
#include "rewrite/rewriteDefine.h"
#include "rewrite/rewriteHandler.h"
+#include "storage/bufmgr.h"
#include "storage/smgr.h"
#include "utils/acl.h"
#include "utils/builtins.h"
diff --git a/src/backend/commands/tablespace.c b/src/backend/commands/tablespace.c
index a89cf5cfaa..ffc5883236 100644
--- a/src/backend/commands/tablespace.c
+++ b/src/backend/commands/tablespace.c
@@ -49,6 +49,7 @@
#include <sys/stat.h>
#include "access/heapam.h"
+#include "access/sysattr.h"
#include "access/xact.h"
#include "catalog/catalog.h"
#include "catalog/dependency.h"
diff --git a/src/backend/commands/trigger.c b/src/backend/commands/trigger.c
index fd835d154f..4062306473 100644
--- a/src/backend/commands/trigger.c
+++ b/src/backend/commands/trigger.c
@@ -15,6 +15,7 @@
#include "access/genam.h"
#include "access/heapam.h"
+#include "access/sysattr.h"
#include "access/xact.h"
#include "catalog/catalog.h"
#include "catalog/dependency.h"
@@ -31,6 +32,7 @@
#include "miscadmin.h"
#include "nodes/makefuncs.h"
#include "parser/parse_func.h"
+#include "storage/bufmgr.h"
#include "tcop/utility.h"
#include "utils/acl.h"
#include "utils/builtins.h"
diff --git a/src/backend/commands/user.c b/src/backend/commands/user.c
index 7166ce6919..69c2a49f37 100644
--- a/src/backend/commands/user.c
+++ b/src/backend/commands/user.c
@@ -23,6 +23,7 @@
#include "commands/user.h"
#include "libpq/md5.h"
#include "miscadmin.h"
+#include "storage/lmgr.h"
#include "utils/acl.h"
#include "utils/builtins.h"
#include "utils/flatfiles.h"
diff --git a/src/backend/commands/vacuum.c b/src/backend/commands/vacuum.c
index ff9ddce147..b1ea791db5 100644
--- a/src/backend/commands/vacuum.c
+++ b/src/backend/commands/vacuum.c
@@ -37,7 +37,9 @@
#include "miscadmin.h"
#include "pgstat.h"
#include "postmaster/autovacuum.h"
+#include "storage/bufmgr.h"
#include "storage/freespace.h"
+#include "storage/lmgr.h"
#include "storage/proc.h"
#include "storage/procarray.h"
#include "utils/acl.h"
diff --git a/src/backend/commands/vacuumlazy.c b/src/backend/commands/vacuumlazy.c
index 42162d2d98..a9b8a0a8d4 100644
--- a/src/backend/commands/vacuumlazy.c
+++ b/src/backend/commands/vacuumlazy.c
@@ -54,7 +54,9 @@
#include "miscadmin.h"
#include "pgstat.h"
#include "postmaster/autovacuum.h"
+#include "storage/bufmgr.h"
#include "storage/freespace.h"
+#include "storage/lmgr.h"
#include "utils/lsyscache.h"
#include "utils/memutils.h"
#include "utils/pg_rusage.h"
diff --git a/src/backend/executor/execCurrent.c b/src/backend/executor/execCurrent.c
index 0fcb256b7d..a4992cfe16 100644
--- a/src/backend/executor/execCurrent.c
+++ b/src/backend/executor/execCurrent.c
@@ -12,6 +12,7 @@
*/
#include "postgres.h"
+#include "access/sysattr.h"
#include "catalog/pg_type.h"
#include "executor/executor.h"
#include "utils/builtins.h"
diff --git a/src/backend/executor/execMain.c b/src/backend/executor/execMain.c
index 014e800f34..c3edf22342 100644
--- a/src/backend/executor/execMain.c
+++ b/src/backend/executor/execMain.c
@@ -48,6 +48,8 @@
#include "optimizer/clauses.h"
#include "parser/parse_clause.h"
#include "parser/parsetree.h"
+#include "storage/bufmgr.h"
+#include "storage/lmgr.h"
#include "storage/smgr.h"
#include "utils/acl.h"
#include "utils/lsyscache.h"
diff --git a/src/backend/executor/execQual.c b/src/backend/executor/execQual.c
index 68fe5d11c9..e5e7b05845 100644
--- a/src/backend/executor/execQual.c
+++ b/src/backend/executor/execQual.c
@@ -36,7 +36,6 @@
#include "postgres.h"
-#include "access/heapam.h"
#include "access/nbtree.h"
#include "catalog/pg_type.h"
#include "commands/typecmds.h"
diff --git a/src/backend/executor/execTuples.c b/src/backend/executor/execTuples.c
index 30d1591e72..eb200d407c 100644
--- a/src/backend/executor/execTuples.c
+++ b/src/backend/executor/execTuples.c
@@ -92,9 +92,9 @@
#include "postgres.h"
#include "funcapi.h"
-#include "access/heapam.h"
#include "catalog/pg_type.h"
#include "parser/parse_expr.h"
+#include "storage/bufmgr.h"
#include "utils/lsyscache.h"
#include "utils/typcache.h"
diff --git a/src/backend/executor/nodeAgg.c b/src/backend/executor/nodeAgg.c
index 328c34928d..dfe593dca2 100644
--- a/src/backend/executor/nodeAgg.c
+++ b/src/backend/executor/nodeAgg.c
@@ -68,7 +68,6 @@
#include "postgres.h"
-#include "access/heapam.h"
#include "catalog/pg_aggregate.h"
#include "catalog/pg_proc.h"
#include "catalog/pg_type.h"
diff --git a/src/backend/executor/nodeBitmapHeapscan.c b/src/backend/executor/nodeBitmapHeapscan.c
index 4fe71adb71..8f8fcc74e3 100644
--- a/src/backend/executor/nodeBitmapHeapscan.c
+++ b/src/backend/executor/nodeBitmapHeapscan.c
@@ -39,6 +39,7 @@
#include "executor/execdebug.h"
#include "executor/nodeBitmapHeapscan.h"
#include "pgstat.h"
+#include "storage/bufmgr.h"
#include "utils/memutils.h"
#include "utils/snapmgr.h"
#include "utils/tqual.h"
diff --git a/src/backend/executor/nodeSubplan.c b/src/backend/executor/nodeSubplan.c
index 5432e77eaf..7eeff58c79 100644
--- a/src/backend/executor/nodeSubplan.c
+++ b/src/backend/executor/nodeSubplan.c
@@ -20,7 +20,6 @@
#include <math.h>
-#include "access/heapam.h"
#include "executor/executor.h"
#include "executor/nodeSubplan.h"
#include "nodes/makefuncs.h"
diff --git a/src/backend/executor/nodeTidscan.c b/src/backend/executor/nodeTidscan.c
index 7a1f5cdaf7..67101b595a 100644
--- a/src/backend/executor/nodeTidscan.c
+++ b/src/backend/executor/nodeTidscan.c
@@ -25,10 +25,12 @@
#include "postgres.h"
#include "access/heapam.h"
+#include "access/sysattr.h"
#include "catalog/pg_type.h"
#include "executor/execdebug.h"
#include "executor/nodeTidscan.h"
#include "optimizer/clauses.h"
+#include "storage/bufmgr.h"
#include "utils/array.h"
diff --git a/src/backend/executor/spi.c b/src/backend/executor/spi.c
index ca54c603a4..4e8d91ad0f 100644
--- a/src/backend/executor/spi.c
+++ b/src/backend/executor/spi.c
@@ -15,6 +15,7 @@
#include "postgres.h"
#include "access/printtup.h"
+#include "access/sysattr.h"
#include "catalog/heap.h"
#include "commands/trigger.h"
#include "executor/spi_priv.h"
diff --git a/src/backend/optimizer/path/tidpath.c b/src/backend/optimizer/path/tidpath.c
index d42a7db577..89dcf31ee6 100644
--- a/src/backend/optimizer/path/tidpath.c
+++ b/src/backend/optimizer/path/tidpath.c
@@ -36,7 +36,7 @@
*/
#include "postgres.h"
-#include "access/htup.h"
+#include "access/sysattr.h"
#include "catalog/pg_operator.h"
#include "catalog/pg_type.h"
#include "optimizer/clauses.h"
diff --git a/src/backend/optimizer/prep/preptlist.c b/src/backend/optimizer/prep/preptlist.c
index d20c26263b..42549b2948 100644
--- a/src/backend/optimizer/prep/preptlist.c
+++ b/src/backend/optimizer/prep/preptlist.c
@@ -24,6 +24,7 @@
#include "postgres.h"
#include "access/heapam.h"
+#include "access/sysattr.h"
#include "catalog/pg_type.h"
#include "nodes/makefuncs.h"
#include "optimizer/prep.h"
diff --git a/src/backend/optimizer/util/clauses.c b/src/backend/optimizer/util/clauses.c
index 6935ec7ae8..cf10c34f2b 100644
--- a/src/backend/optimizer/util/clauses.c
+++ b/src/backend/optimizer/util/clauses.c
@@ -19,7 +19,6 @@
#include "postgres.h"
-#include "access/heapam.h"
#include "catalog/pg_aggregate.h"
#include "catalog/pg_language.h"
#include "catalog/pg_operator.h"
diff --git a/src/backend/optimizer/util/plancat.c b/src/backend/optimizer/util/plancat.c
index d10ba4cae5..475c313775 100644
--- a/src/backend/optimizer/util/plancat.c
+++ b/src/backend/optimizer/util/plancat.c
@@ -19,6 +19,7 @@
#include "access/genam.h"
#include "access/heapam.h"
+#include "access/sysattr.h"
#include "access/transam.h"
#include "catalog/catalog.h"
#include "catalog/pg_inherits.h"
@@ -32,6 +33,7 @@
#include "parser/parse_relation.h"
#include "parser/parsetree.h"
#include "rewrite/rewriteManip.h"
+#include "storage/bufmgr.h"
#include "utils/fmgroids.h"
#include "utils/lsyscache.h"
#include "utils/relcache.h"
diff --git a/src/backend/optimizer/util/var.c b/src/backend/optimizer/util/var.c
index a5c577cab2..7f3c82872a 100644
--- a/src/backend/optimizer/util/var.c
+++ b/src/backend/optimizer/util/var.c
@@ -14,7 +14,7 @@
*/
#include "postgres.h"
-#include "access/htup.h"
+#include "access/sysattr.h"
#include "optimizer/clauses.h"
#include "optimizer/prep.h"
#include "optimizer/var.h"
diff --git a/src/backend/parser/parse_relation.c b/src/backend/parser/parse_relation.c
index 737b093a1b..dd626a6a1b 100644
--- a/src/backend/parser/parse_relation.c
+++ b/src/backend/parser/parse_relation.c
@@ -17,6 +17,7 @@
#include <ctype.h>
#include "access/heapam.h"
+#include "access/sysattr.h"
#include "catalog/heap.h"
#include "catalog/namespace.h"
#include "catalog/pg_type.h"
diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c
index cc78cf0fc1..188fd2ab5d 100644
--- a/src/backend/postmaster/autovacuum.c
+++ b/src/backend/postmaster/autovacuum.c
@@ -84,6 +84,7 @@
#include "postmaster/autovacuum.h"
#include "postmaster/fork_process.h"
#include "postmaster/postmaster.h"
+#include "storage/bufmgr.h"
#include "storage/fd.h"
#include "storage/ipc.h"
#include "storage/pmsignal.h"
diff --git a/src/backend/postmaster/bgwriter.c b/src/backend/postmaster/bgwriter.c
index 97b6b3c2d4..a9afa183d9 100644
--- a/src/backend/postmaster/bgwriter.c
+++ b/src/backend/postmaster/bgwriter.c
@@ -53,6 +53,7 @@
#include "miscadmin.h"
#include "pgstat.h"
#include "postmaster/bgwriter.h"
+#include "storage/bufmgr.h"
#include "storage/fd.h"
#include "storage/freespace.h"
#include "storage/ipc.h"
diff --git a/src/backend/rewrite/rewriteRemove.c b/src/backend/rewrite/rewriteRemove.c
index b99c3dc2e0..3b256717c0 100644
--- a/src/backend/rewrite/rewriteRemove.c
+++ b/src/backend/rewrite/rewriteRemove.c
@@ -16,6 +16,7 @@
#include "access/genam.h"
#include "access/heapam.h"
+#include "access/sysattr.h"
#include "catalog/dependency.h"
#include "catalog/indexing.h"
#include "catalog/pg_rewrite.h"
diff --git a/src/backend/storage/buffer/bufmgr.c b/src/backend/storage/buffer/bufmgr.c
index f098d1a307..f63b49c34b 100644
--- a/src/backend/storage/buffer/bufmgr.c
+++ b/src/backend/storage/buffer/bufmgr.c
@@ -36,6 +36,7 @@
#include "miscadmin.h"
#include "postmaster/bgwriter.h"
#include "storage/buf_internals.h"
+#include "storage/bufmgr.h"
#include "storage/bufpage.h"
#include "storage/ipc.h"
#include "storage/proc.h"
diff --git a/src/backend/storage/ipc/ipci.c b/src/backend/storage/ipc/ipci.c
index ff87ba11d6..5ec922b192 100644
--- a/src/backend/storage/ipc/ipci.c
+++ b/src/backend/storage/ipc/ipci.c
@@ -25,6 +25,7 @@
#include "postmaster/autovacuum.h"
#include "postmaster/bgwriter.h"
#include "postmaster/postmaster.h"
+#include "storage/bufmgr.h"
#include "storage/freespace.h"
#include "storage/ipc.h"
#include "storage/pg_shmem.h"
diff --git a/src/backend/tcop/postgres.c b/src/backend/tcop/postgres.c
index 56efa4cbf7..6e74d57df3 100644
--- a/src/backend/tcop/postgres.c
+++ b/src/backend/tcop/postgres.c
@@ -54,6 +54,7 @@
#include "parser/parser.h"
#include "postmaster/autovacuum.h"
#include "rewrite/rewriteHandler.h"
+#include "storage/bufmgr.h"
#include "storage/freespace.h"
#include "storage/ipc.h"
#include "storage/proc.h"
diff --git a/src/backend/tsearch/wparser.c b/src/backend/tsearch/wparser.c
index 996d3bcc26..829dcc3fb5 100644
--- a/src/backend/tsearch/wparser.c
+++ b/src/backend/tsearch/wparser.c
@@ -15,7 +15,6 @@
#include "funcapi.h"
#include "access/genam.h"
-#include "access/heapam.h"
#include "access/skey.h"
#include "catalog/indexing.h"
#include "catalog/namespace.h"
diff --git a/src/backend/utils/adt/arrayfuncs.c b/src/backend/utils/adt/arrayfuncs.c
index ae64195e3b..57eca82d3c 100644
--- a/src/backend/utils/adt/arrayfuncs.c
+++ b/src/backend/utils/adt/arrayfuncs.c
@@ -16,7 +16,6 @@
#include <ctype.h>
-#include "access/tupmacs.h"
#include "funcapi.h"
#include "libpq/pqformat.h"
#include "parser/parse_coerce.h"
diff --git a/src/backend/utils/adt/datetime.c b/src/backend/utils/adt/datetime.c
index b5b98af2da..a88323ff69 100644
--- a/src/backend/utils/adt/datetime.c
+++ b/src/backend/utils/adt/datetime.c
@@ -19,7 +19,6 @@
#include <limits.h>
#include <math.h>
-#include "access/heapam.h"
#include "access/xact.h"
#include "catalog/pg_type.h"
#include "funcapi.h"
diff --git a/src/backend/utils/adt/genfile.c b/src/backend/utils/adt/genfile.c
index 211e17a27d..b36fa5d8e2 100644
--- a/src/backend/utils/adt/genfile.c
+++ b/src/backend/utils/adt/genfile.c
@@ -20,7 +20,6 @@
#include <unistd.h>
#include <dirent.h>
-#include "access/heapam.h"
#include "catalog/pg_type.h"
#include "funcapi.h"
#include "miscadmin.h"
diff --git a/src/backend/utils/adt/lockfuncs.c b/src/backend/utils/adt/lockfuncs.c
index 3248951089..09cf1df9f4 100644
--- a/src/backend/utils/adt/lockfuncs.c
+++ b/src/backend/utils/adt/lockfuncs.c
@@ -12,7 +12,6 @@
*/
#include "postgres.h"
-#include "access/heapam.h"
#include "catalog/pg_type.h"
#include "funcapi.h"
#include "miscadmin.h"
diff --git a/src/backend/utils/adt/pgstatfuncs.c b/src/backend/utils/adt/pgstatfuncs.c
index a7fcce8d60..30a4dda2f6 100644
--- a/src/backend/utils/adt/pgstatfuncs.c
+++ b/src/backend/utils/adt/pgstatfuncs.c
@@ -18,7 +18,6 @@
#include "miscadmin.h"
#include "pgstat.h"
#include "catalog/pg_type.h"
-#include "access/heapam.h"
#include "utils/builtins.h"
#include "utils/inet.h"
#include "libpq/ip.h"
diff --git a/src/backend/utils/adt/rowtypes.c b/src/backend/utils/adt/rowtypes.c
index 1d7420e3ee..8b8e2b2ddd 100644
--- a/src/backend/utils/adt/rowtypes.c
+++ b/src/backend/utils/adt/rowtypes.c
@@ -16,7 +16,6 @@
#include <ctype.h>
-#include "access/heapam.h"
#include "catalog/pg_type.h"
#include "libpq/pqformat.h"
#include "utils/builtins.h"
diff --git a/src/backend/utils/adt/ruleutils.c b/src/backend/utils/adt/ruleutils.c
index dbeff27362..f400ca273a 100644
--- a/src/backend/utils/adt/ruleutils.c
+++ b/src/backend/utils/adt/ruleutils.c
@@ -19,6 +19,7 @@
#include <fcntl.h>
#include "access/genam.h"
+#include "access/sysattr.h"
#include "catalog/dependency.h"
#include "catalog/indexing.h"
#include "catalog/pg_authid.h"
diff --git a/src/backend/utils/adt/selfuncs.c b/src/backend/utils/adt/selfuncs.c
index 1d02c95946..596d35ba7c 100644
--- a/src/backend/utils/adt/selfuncs.c
+++ b/src/backend/utils/adt/selfuncs.c
@@ -76,6 +76,7 @@
#include <ctype.h>
#include <math.h>
+#include "access/sysattr.h"
#include "catalog/pg_opfamily.h"
#include "catalog/pg_statistic.h"
#include "catalog/pg_type.h"
diff --git a/src/backend/utils/adt/tid.c b/src/backend/utils/adt/tid.c
index 4784df774a..1ab73a66fc 100644
--- a/src/backend/utils/adt/tid.c
+++ b/src/backend/utils/adt/tid.c
@@ -21,6 +21,7 @@
#include <limits.h>
#include "access/heapam.h"
+#include "access/sysattr.h"
#include "catalog/namespace.h"
#include "catalog/pg_type.h"
#include "libpq/pqformat.h"
diff --git a/src/backend/utils/adt/varlena.c b/src/backend/utils/adt/varlena.c
index 657f0f89b8..3289c395da 100644
--- a/src/backend/utils/adt/varlena.c
+++ b/src/backend/utils/adt/varlena.c
@@ -16,7 +16,6 @@
#include <ctype.h>
-#include "access/tupmacs.h"
#include "access/tuptoaster.h"
#include "catalog/pg_type.h"
#include "libpq/md5.h"
diff --git a/src/backend/utils/adt/xml.c b/src/backend/utils/adt/xml.c
index 9ad3ff81fd..708fe5f72f 100644
--- a/src/backend/utils/adt/xml.c
+++ b/src/backend/utils/adt/xml.c
@@ -81,7 +81,6 @@
#include "utils/datetime.h"
#include "utils/lsyscache.h"
#include "utils/memutils.h"
-#include "access/tupmacs.h"
#include "utils/xml.h"
diff --git a/src/backend/utils/cache/catcache.c b/src/backend/utils/cache/catcache.c
index 3f3c67d53e..7affec2d09 100644
--- a/src/backend/utils/cache/catcache.c
+++ b/src/backend/utils/cache/catcache.c
@@ -17,6 +17,7 @@
#include "access/genam.h"
#include "access/hash.h"
#include "access/heapam.h"
+#include "access/sysattr.h"
#include "access/valid.h"
#include "catalog/pg_operator.h"
#include "catalog/pg_type.h"
diff --git a/src/backend/utils/cache/relcache.c b/src/backend/utils/cache/relcache.c
index c1080aa459..74c70f28ae 100644
--- a/src/backend/utils/cache/relcache.c
+++ b/src/backend/utils/cache/relcache.c
@@ -32,6 +32,7 @@
#include "access/genam.h"
#include "access/heapam.h"
#include "access/reloptions.h"
+#include "access/sysattr.h"
#include "access/xact.h"
#include "catalog/catalog.h"
#include "catalog/index.h"
@@ -55,6 +56,7 @@
#include "optimizer/var.h"
#include "rewrite/rewriteDefine.h"
#include "storage/fd.h"
+#include "storage/lmgr.h"
#include "storage/smgr.h"
#include "utils/builtins.h"
#include "utils/fmgroids.h"
diff --git a/src/backend/utils/cache/syscache.c b/src/backend/utils/cache/syscache.c
index b8b1a431f8..adb4d6b80a 100644
--- a/src/backend/utils/cache/syscache.c
+++ b/src/backend/utils/cache/syscache.c
@@ -20,7 +20,7 @@
*/
#include "postgres.h"
-#include "access/heapam.h"
+#include "access/sysattr.h"
#include "catalog/indexing.h"
#include "catalog/pg_aggregate.h"
#include "catalog/pg_amop.h"
diff --git a/src/backend/utils/fmgr/fmgr.c b/src/backend/utils/fmgr/fmgr.c
index 72d3ecf515..c74bfd5c16 100644
--- a/src/backend/utils/fmgr/fmgr.c
+++ b/src/backend/utils/fmgr/fmgr.c
@@ -15,7 +15,6 @@
#include "postgres.h"
-#include "access/heapam.h"
#include "access/tuptoaster.h"
#include "catalog/pg_language.h"
#include "catalog/pg_proc.h"
diff --git a/src/backend/utils/init/flatfiles.c b/src/backend/utils/init/flatfiles.c
index 8addd6e397..4ec2680265 100644
--- a/src/backend/utils/init/flatfiles.c
+++ b/src/backend/utils/init/flatfiles.c
@@ -36,6 +36,7 @@
#include "access/transam.h"
#include "access/twophase_rmgr.h"
#include "access/xact.h"
+#include "access/xlogutils.h"
#include "catalog/catalog.h"
#include "catalog/pg_auth_members.h"
#include "catalog/pg_authid.h"
@@ -44,7 +45,9 @@
#include "catalog/pg_tablespace.h"
#include "commands/trigger.h"
#include "miscadmin.h"
+#include "storage/bufmgr.h"
#include "storage/fd.h"
+#include "storage/lmgr.h"
#include "storage/pmsignal.h"
#include "utils/builtins.h"
#include "utils/flatfiles.h"
diff --git a/src/backend/utils/init/postinit.c b/src/backend/utils/init/postinit.c
index c848797f7d..f8ad868677 100644
--- a/src/backend/utils/init/postinit.c
+++ b/src/backend/utils/init/postinit.c
@@ -33,8 +33,10 @@
#include "postmaster/autovacuum.h"
#include "postmaster/postmaster.h"
#include "storage/backendid.h"
+#include "storage/bufmgr.h"
#include "storage/fd.h"
#include "storage/ipc.h"
+#include "storage/lmgr.h"
#include "storage/proc.h"
#include "storage/procarray.h"
#include "storage/sinvaladt.h"
diff --git a/src/backend/utils/misc/guc.c b/src/backend/utils/misc/guc.c
index 4c3e2c874c..c1ea498da1 100644
--- a/src/backend/utils/misc/guc.c
+++ b/src/backend/utils/misc/guc.c
@@ -55,6 +55,7 @@
#include "postmaster/syslogger.h"
#include "postmaster/walwriter.h"
#include "regex/regex.h"
+#include "storage/bufmgr.h"
#include "storage/fd.h"
#include "storage/freespace.h"
#include "tcop/tcopprot.h"
diff --git a/src/backend/utils/mmgr/portalmem.c b/src/backend/utils/mmgr/portalmem.c
index a4db2ae2f8..1117af42a4 100644
--- a/src/backend/utils/mmgr/portalmem.c
+++ b/src/backend/utils/mmgr/portalmem.c
@@ -18,7 +18,6 @@
*/
#include "postgres.h"
-#include "access/heapam.h"
#include "access/xact.h"
#include "catalog/pg_type.h"
#include "commands/portalcmds.h"
diff --git a/src/backend/utils/resowner/resowner.c b/src/backend/utils/resowner/resowner.c
index 3c4a5ee4a6..b68014d76c 100644
--- a/src/backend/utils/resowner/resowner.c
+++ b/src/backend/utils/resowner/resowner.c
@@ -21,6 +21,7 @@
#include "postgres.h"
#include "access/hash.h"
+#include "storage/bufmgr.h"
#include "storage/proc.h"
#include "utils/memutils.h"
#include "utils/resowner.h"
diff --git a/src/backend/utils/sort/tuplesort.c b/src/backend/utils/sort/tuplesort.c
index 85658f07eb..a0a6bd7a50 100644
--- a/src/backend/utils/sort/tuplesort.c
+++ b/src/backend/utils/sort/tuplesort.c
@@ -102,7 +102,6 @@
#include "access/genam.h"
#include "access/hash.h"
-#include "access/heapam.h"
#include "access/nbtree.h"
#include "catalog/pg_amop.h"
#include "catalog/pg_operator.h"
diff --git a/src/backend/utils/sort/tuplestore.c b/src/backend/utils/sort/tuplestore.c
index 435cfc0e5c..987355cd10 100644
--- a/src/backend/utils/sort/tuplestore.c
+++ b/src/backend/utils/sort/tuplestore.c
@@ -45,7 +45,6 @@
#include "postgres.h"
-#include "access/heapam.h"
#include "commands/tablespace.h"
#include "executor/executor.h"
#include "storage/buffile.h"
diff --git a/src/bin/pg_dump/pg_dump.c b/src/bin/pg_dump/pg_dump.c
index 95199234ac..3334118de4 100644
--- a/src/bin/pg_dump/pg_dump.c
+++ b/src/bin/pg_dump/pg_dump.c
@@ -35,7 +35,7 @@ int optreset;
#endif
#include "access/attnum.h"
-#include "access/htup.h"
+#include "access/sysattr.h"
#include "catalog/pg_class.h"
#include "catalog/pg_proc.h"
#include "catalog/pg_trigger.h"
diff --git a/src/include/access/genam.h b/src/include/access/genam.h
index b07993bfe8..b4d534ec29 100644
--- a/src/include/access/genam.h
+++ b/src/include/access/genam.h
@@ -16,9 +16,10 @@
#include "access/relscan.h"
#include "access/sdir.h"
-#include "nodes/primnodes.h"
#include "nodes/tidbitmap.h"
+#include "storage/buf.h"
#include "storage/lock.h"
+#include "utils/rel.h"
/*
* Struct for statistics returned by ambuild
diff --git a/src/include/access/gin.h b/src/include/access/gin.h
index 5fbf35eff2..2a5247dc0b 100644
--- a/src/include/access/gin.h
+++ b/src/include/access/gin.h
@@ -12,15 +12,13 @@
#ifndef GIN_H
#define GIN_H
-#include "access/relscan.h"
-#include "access/skey.h"
-#include "access/xlog.h"
-#include "access/xlogdefs.h"
-#include "storage/bufpage.h"
-#include "storage/off.h"
-#include "utils/rel.h"
#include "access/itup.h"
+#include "access/relscan.h"
#include "fmgr.h"
+#include "storage/block.h"
+#include "storage/buf.h"
+#include "storage/off.h"
+#include "storage/relfilenode.h"
/*
diff --git a/src/include/access/gist.h b/src/include/access/gist.h
index fe7c6a3ec2..106de89a06 100644
--- a/src/include/access/gist.h
+++ b/src/include/access/gist.h
@@ -19,7 +19,6 @@
#include "access/xlog.h"
#include "access/xlogdefs.h"
#include "storage/bufpage.h"
-#include "storage/off.h"
#include "utils/rel.h"
/*
diff --git a/src/include/access/gistscan.h b/src/include/access/gistscan.h
index 7a00a99547..fc2385a079 100644
--- a/src/include/access/gistscan.h
+++ b/src/include/access/gistscan.h
@@ -14,7 +14,7 @@
#ifndef GISTSCAN_H
#define GISTSCAN_H
-#include "access/relscan.h"
+#include "fmgr.h"
extern Datum gistbeginscan(PG_FUNCTION_ARGS);
extern Datum gistrescan(PG_FUNCTION_ARGS);
diff --git a/src/include/access/heapam.h b/src/include/access/heapam.h
index d0f41d264f..f29f835e90 100644
--- a/src/include/access/heapam.h
+++ b/src/include/access/heapam.h
@@ -17,100 +17,10 @@
#include "access/htup.h"
#include "access/relscan.h"
#include "access/sdir.h"
-#include "access/tupmacs.h"
-#include "access/xlogutils.h"
#include "nodes/primnodes.h"
-#include "storage/block.h"
-#include "storage/lmgr.h"
-#include "utils/rel.h"
+#include "storage/lock.h"
#include "utils/snapshot.h"
-/* ----------------
- * fastgetattr
- *
- * Fetch a user attribute's value as a Datum (might be either a
- * value, or a pointer into the data area of the tuple).
- *
- * This must not be used when a system attribute might be requested.
- * Furthermore, the passed attnum MUST be valid. Use heap_getattr()
- * instead, if in doubt.
- *
- * This gets called many times, so we macro the cacheable and NULL
- * lookups, and call nocachegetattr() for the rest.
- * ----------------
- */
-
-#if !defined(DISABLE_COMPLEX_MACRO)
-
-#define fastgetattr(tup, attnum, tupleDesc, isnull) \
-( \
- AssertMacro((attnum) > 0), \
- (((isnull) != NULL) ? (*(isnull) = false) : (dummyret)NULL), \
- HeapTupleNoNulls(tup) ? \
- ( \
- (tupleDesc)->attrs[(attnum)-1]->attcacheoff >= 0 ? \
- ( \
- fetchatt((tupleDesc)->attrs[(attnum)-1], \
- (char *) (tup)->t_data + (tup)->t_data->t_hoff + \
- (tupleDesc)->attrs[(attnum)-1]->attcacheoff) \
- ) \
- : \
- nocachegetattr((tup), (attnum), (tupleDesc), (isnull)) \
- ) \
- : \
- ( \
- att_isnull((attnum)-1, (tup)->t_data->t_bits) ? \
- ( \
- (((isnull) != NULL) ? (*(isnull) = true) : (dummyret)NULL), \
- (Datum)NULL \
- ) \
- : \
- ( \
- nocachegetattr((tup), (attnum), (tupleDesc), (isnull)) \
- ) \
- ) \
-)
-#else /* defined(DISABLE_COMPLEX_MACRO) */
-
-extern Datum fastgetattr(HeapTuple tup, int attnum, TupleDesc tupleDesc,
- bool *isnull);
-#endif /* defined(DISABLE_COMPLEX_MACRO) */
-
-
-/* ----------------
- * heap_getattr
- *
- * Extract an attribute of a heap tuple and return it as a Datum.
- * This works for either system or user attributes. The given attnum
- * is properly range-checked.
- *
- * If the field in question has a NULL value, we return a zero Datum
- * and set *isnull == true. Otherwise, we set *isnull == false.
- *
- * <tup> is the pointer to the heap tuple. <attnum> is the attribute
- * number of the column (field) caller wants. <tupleDesc> is a
- * pointer to the structure describing the row and all its fields.
- * ----------------
- */
-#define heap_getattr(tup, attnum, tupleDesc, isnull) \
-( \
- AssertMacro((tup) != NULL), \
- ( \
- ((attnum) > 0) ? \
- ( \
- ((attnum) > (int) HeapTupleHeaderGetNatts((tup)->t_data)) ? \
- ( \
- (((isnull) != NULL) ? (*(isnull) = true) : (dummyret)NULL), \
- (Datum)NULL \
- ) \
- : \
- fastgetattr((tup), (attnum), (tupleDesc), (isnull)) \
- ) \
- : \
- heap_getsysattr((tup), (attnum), (tupleDesc), (isnull)) \
- ) \
-)
-
typedef enum
{
@@ -207,48 +117,6 @@ extern XLogRecPtr log_heap_freeze(Relation reln, Buffer buffer,
OffsetNumber *offsets, int offcnt);
extern XLogRecPtr log_newpage(RelFileNode *rnode, BlockNumber blk, Page page);
-/* in common/heaptuple.c */
-extern Size heap_compute_data_size(TupleDesc tupleDesc,
- Datum *values, bool *isnull);
-extern void heap_fill_tuple(TupleDesc tupleDesc,
- Datum *values, bool *isnull,
- char *data, Size data_size,
- uint16 *infomask, bits8 *bit);
-extern bool heap_attisnull(HeapTuple tup, int attnum);
-extern Datum nocachegetattr(HeapTuple tup, int attnum,
- TupleDesc att, bool *isnull);
-extern Datum heap_getsysattr(HeapTuple tup, int attnum, TupleDesc tupleDesc,
- bool *isnull);
-extern HeapTuple heap_copytuple(HeapTuple tuple);
-extern void heap_copytuple_with_tuple(HeapTuple src, HeapTuple dest);
-extern HeapTuple heap_form_tuple(TupleDesc tupleDescriptor,
- Datum *values, bool *isnull);
-extern HeapTuple heap_formtuple(TupleDesc tupleDescriptor,
- Datum *values, char *nulls);
-extern HeapTuple heap_modify_tuple(HeapTuple tuple,
- TupleDesc tupleDesc,
- Datum *replValues,
- bool *replIsnull,
- bool *doReplace);
-extern HeapTuple heap_modifytuple(HeapTuple tuple,
- TupleDesc tupleDesc,
- Datum *replValues,
- char *replNulls,
- char *replActions);
-extern void heap_deform_tuple(HeapTuple tuple, TupleDesc tupleDesc,
- Datum *values, bool *isnull);
-extern void heap_deformtuple(HeapTuple tuple, TupleDesc tupleDesc,
- Datum *values, char *nulls);
-extern void heap_freetuple(HeapTuple htup);
-extern MinimalTuple heap_form_minimal_tuple(TupleDesc tupleDescriptor,
- Datum *values, bool *isnull);
-extern void heap_free_minimal_tuple(MinimalTuple mtup);
-extern MinimalTuple heap_copy_minimal_tuple(MinimalTuple mtup);
-extern HeapTuple heap_tuple_from_minimal_tuple(MinimalTuple mtup);
-extern MinimalTuple minimal_tuple_from_heap_tuple(HeapTuple htup);
-extern HeapTuple heap_addheader(int natts, bool withoid,
- Size structlen, void *structure);
-
/* in heap/pruneheap.c */
extern void heap_page_prune_opt(Relation relation, Buffer buffer,
TransactionId OldestXmin);
diff --git a/src/include/access/htup.h b/src/include/access/htup.h
index 53ac9fbda5..f202959ee7 100644
--- a/src/include/access/htup.h
+++ b/src/include/access/htup.h
@@ -14,6 +14,8 @@
#ifndef HTUP_H
#define HTUP_H
+#include "access/tupdesc.h"
+#include "access/tupmacs.h"
#include "storage/itemptr.h"
#include "storage/relfilenode.h"
@@ -393,19 +395,6 @@ do { \
/*
- * Attribute numbers for the system-defined attributes
- */
-#define SelfItemPointerAttributeNumber (-1)
-#define ObjectIdAttributeNumber (-2)
-#define MinTransactionIdAttributeNumber (-3)
-#define MinCommandIdAttributeNumber (-4)
-#define MaxTransactionIdAttributeNumber (-5)
-#define MaxCommandIdAttributeNumber (-6)
-#define TableOidAttributeNumber (-7)
-#define FirstLowInvalidHeapAttributeNumber (-8)
-
-
-/*
* MinimalTuple is an alternative representation that is used for transient
* tuples inside the executor, in places where transaction status information
* is not required, the tuple rowtype is known, and shaving off a few bytes
@@ -725,4 +714,132 @@ extern void HeapTupleHeaderAdjustCmax(HeapTupleHeader tup,
CommandId *cmax,
bool *iscombo);
+/* ----------------
+ * fastgetattr
+ *
+ * Fetch a user attribute's value as a Datum (might be either a
+ * value, or a pointer into the data area of the tuple).
+ *
+ * This must not be used when a system attribute might be requested.
+ * Furthermore, the passed attnum MUST be valid. Use heap_getattr()
+ * instead, if in doubt.
+ *
+ * This gets called many times, so we macro the cacheable and NULL
+ * lookups, and call nocachegetattr() for the rest.
+ * ----------------
+ */
+
+#if !defined(DISABLE_COMPLEX_MACRO)
+
+#define fastgetattr(tup, attnum, tupleDesc, isnull) \
+( \
+ AssertMacro((attnum) > 0), \
+ (((isnull) != NULL) ? (*(isnull) = false) : (dummyret)NULL), \
+ HeapTupleNoNulls(tup) ? \
+ ( \
+ (tupleDesc)->attrs[(attnum)-1]->attcacheoff >= 0 ? \
+ ( \
+ fetchatt((tupleDesc)->attrs[(attnum)-1], \
+ (char *) (tup)->t_data + (tup)->t_data->t_hoff + \
+ (tupleDesc)->attrs[(attnum)-1]->attcacheoff) \
+ ) \
+ : \
+ nocachegetattr((tup), (attnum), (tupleDesc), (isnull)) \
+ ) \
+ : \
+ ( \
+ att_isnull((attnum)-1, (tup)->t_data->t_bits) ? \
+ ( \
+ (((isnull) != NULL) ? (*(isnull) = true) : (dummyret)NULL), \
+ (Datum)NULL \
+ ) \
+ : \
+ ( \
+ nocachegetattr((tup), (attnum), (tupleDesc), (isnull)) \
+ ) \
+ ) \
+)
+#else /* defined(DISABLE_COMPLEX_MACRO) */
+
+extern Datum fastgetattr(HeapTuple tup, int attnum, TupleDesc tupleDesc,
+ bool *isnull);
+#endif /* defined(DISABLE_COMPLEX_MACRO) */
+
+
+/* ----------------
+ * heap_getattr
+ *
+ * Extract an attribute of a heap tuple and return it as a Datum.
+ * This works for either system or user attributes. The given attnum
+ * is properly range-checked.
+ *
+ * If the field in question has a NULL value, we return a zero Datum
+ * and set *isnull == true. Otherwise, we set *isnull == false.
+ *
+ * <tup> is the pointer to the heap tuple. <attnum> is the attribute
+ * number of the column (field) caller wants. <tupleDesc> is a
+ * pointer to the structure describing the row and all its fields.
+ * ----------------
+ */
+#define heap_getattr(tup, attnum, tupleDesc, isnull) \
+( \
+ AssertMacro((tup) != NULL), \
+ ( \
+ ((attnum) > 0) ? \
+ ( \
+ ((attnum) > (int) HeapTupleHeaderGetNatts((tup)->t_data)) ? \
+ ( \
+ (((isnull) != NULL) ? (*(isnull) = true) : (dummyret)NULL), \
+ (Datum)NULL \
+ ) \
+ : \
+ fastgetattr((tup), (attnum), (tupleDesc), (isnull)) \
+ ) \
+ : \
+ heap_getsysattr((tup), (attnum), (tupleDesc), (isnull)) \
+ ) \
+)
+
+/* prototypes for functions in common/heaptuple.c */
+extern Size heap_compute_data_size(TupleDesc tupleDesc,
+ Datum *values, bool *isnull);
+extern void heap_fill_tuple(TupleDesc tupleDesc,
+ Datum *values, bool *isnull,
+ char *data, Size data_size,
+ uint16 *infomask, bits8 *bit);
+extern bool heap_attisnull(HeapTuple tup, int attnum);
+extern Datum nocachegetattr(HeapTuple tup, int attnum,
+ TupleDesc att, bool *isnull);
+extern Datum heap_getsysattr(HeapTuple tup, int attnum, TupleDesc tupleDesc,
+ bool *isnull);
+extern HeapTuple heap_copytuple(HeapTuple tuple);
+extern void heap_copytuple_with_tuple(HeapTuple src, HeapTuple dest);
+extern HeapTuple heap_form_tuple(TupleDesc tupleDescriptor,
+ Datum *values, bool *isnull);
+extern HeapTuple heap_formtuple(TupleDesc tupleDescriptor,
+ Datum *values, char *nulls);
+extern HeapTuple heap_modify_tuple(HeapTuple tuple,
+ TupleDesc tupleDesc,
+ Datum *replValues,
+ bool *replIsnull,
+ bool *doReplace);
+extern HeapTuple heap_modifytuple(HeapTuple tuple,
+ TupleDesc tupleDesc,
+ Datum *replValues,
+ char *replNulls,
+ char *replActions);
+extern void heap_deform_tuple(HeapTuple tuple, TupleDesc tupleDesc,
+ Datum *values, bool *isnull);
+extern void heap_deformtuple(HeapTuple tuple, TupleDesc tupleDesc,
+ Datum *values, char *nulls);
+extern void heap_freetuple(HeapTuple htup);
+extern MinimalTuple heap_form_minimal_tuple(TupleDesc tupleDescriptor,
+ Datum *values, bool *isnull);
+extern void heap_free_minimal_tuple(MinimalTuple mtup);
+extern MinimalTuple heap_copy_minimal_tuple(MinimalTuple mtup);
+extern HeapTuple heap_tuple_from_minimal_tuple(MinimalTuple mtup);
+extern MinimalTuple minimal_tuple_from_heap_tuple(HeapTuple htup);
+extern HeapTuple heap_addheader(int natts, bool withoid,
+ Size structlen, void *structure);
+
#endif /* HTUP_H */
diff --git a/src/include/access/relscan.h b/src/include/access/relscan.h
index 0b81fd6271..d13af93739 100644
--- a/src/include/access/relscan.h
+++ b/src/include/access/relscan.h
@@ -17,6 +17,7 @@
#include "access/htup.h"
#include "access/skey.h"
#include "storage/bufpage.h"
+#include "utils/rel.h"
#include "utils/snapshot.h"
diff --git a/src/include/access/sysattr.h b/src/include/access/sysattr.h
new file mode 100644
index 0000000000..f3a24a58db
--- /dev/null
+++ b/src/include/access/sysattr.h
@@ -0,0 +1,31 @@
+/*-------------------------------------------------------------------------
+ *
+ * sysattr.h
+ * POSTGRES system attribute definitions.
+ *
+ *
+ * Portions Copyright (c) 1996-2008, PostgreSQL Global Development Group
+ * Portions Copyright (c) 1994, Regents of the University of California
+ *
+ * $PostgreSQL$
+ *
+ *-------------------------------------------------------------------------
+ */
+#ifndef SYSATTR_H
+#define SYSATTR_H
+
+
+/*
+ * Attribute numbers for the system-defined attributes
+ */
+#define SelfItemPointerAttributeNumber (-1)
+#define ObjectIdAttributeNumber (-2)
+#define MinTransactionIdAttributeNumber (-3)
+#define MinCommandIdAttributeNumber (-4)
+#define MaxTransactionIdAttributeNumber (-5)
+#define MaxCommandIdAttributeNumber (-6)
+#define TableOidAttributeNumber (-7)
+#define FirstLowInvalidHeapAttributeNumber (-8)
+
+
+#endif /* SYSATTR_H */
diff --git a/src/include/access/tuptoaster.h b/src/include/access/tuptoaster.h
index 308fb08646..47b015fb44 100644
--- a/src/include/access/tuptoaster.h
+++ b/src/include/access/tuptoaster.h
@@ -15,6 +15,7 @@
#include "access/htup.h"
#include "storage/bufpage.h"
+#include "utils/rel.h"
/*
* This enables de-toasting of index entries. Needed until VACUUM is
diff --git a/src/include/parser/parser.h b/src/include/parser/parser.h
index a60e83197c..62e2c593f4 100644
--- a/src/include/parser/parser.h
+++ b/src/include/parser/parser.h
@@ -14,6 +14,8 @@
#ifndef PARSER_H
#define PARSER_H
+#include "nodes/pg_list.h"
+
extern List *raw_parser(const char *str);
#endif /* PARSER_H */
diff --git a/src/include/rewrite/rewriteDefine.h b/src/include/rewrite/rewriteDefine.h
index 2a4db46c8b..93fe22a089 100644
--- a/src/include/rewrite/rewriteDefine.h
+++ b/src/include/rewrite/rewriteDefine.h
@@ -15,6 +15,7 @@
#define REWRITEDEFINE_H
#include "nodes/parsenodes.h"
+#include "utils/rel.h"
#define RULE_FIRES_ON_ORIGIN 'O'
#define RULE_FIRES_ALWAYS 'A'
diff --git a/src/include/storage/bufpage.h b/src/include/storage/bufpage.h
index 4245aef0e5..c72e1505c2 100644
--- a/src/include/storage/bufpage.h
+++ b/src/include/storage/bufpage.h
@@ -14,10 +14,9 @@
#ifndef BUFPAGE_H
#define BUFPAGE_H
-#include "storage/bufmgr.h"
+#include "access/xlog.h"
#include "storage/item.h"
#include "storage/off.h"
-#include "access/xlog.h"
/*
* A postgres disk page is an abstraction layered on top of a postgres
diff --git a/src/include/storage/lmgr.h b/src/include/storage/lmgr.h
index 42a890eb9d..de013ac27c 100644
--- a/src/include/storage/lmgr.h
+++ b/src/include/storage/lmgr.h
@@ -15,6 +15,7 @@
#define LMGR_H
#include "lib/stringinfo.h"
+#include "storage/itemptr.h"
#include "storage/lock.h"
#include "utils/rel.h"
diff --git a/src/include/storage/lock.h b/src/include/storage/lock.h
index e335d75330..1deaf8dcd8 100644
--- a/src/include/storage/lock.h
+++ b/src/include/storage/lock.h
@@ -14,9 +14,7 @@
#ifndef LOCK_H_
#define LOCK_H_
-#include "nodes/pg_list.h"
#include "storage/backendid.h"
-#include "storage/itemptr.h"
#include "storage/lwlock.h"
#include "storage/shmem.h"
diff --git a/src/include/utils/tuplesort.h b/src/include/utils/tuplesort.h
index 1b0731fa80..ce3261dc35 100644
--- a/src/include/utils/tuplesort.h
+++ b/src/include/utils/tuplesort.h
@@ -22,6 +22,7 @@
#include "access/itup.h"
#include "executor/tuptable.h"
+#include "utils/rel.h"
/* Tuplesortstate is an opaque type whose details are not known outside
diff --git a/src/pl/plpgsql/src/pl_comp.c b/src/pl/plpgsql/src/pl_comp.c
index cbb6309daf..c67902ebd8 100644
--- a/src/pl/plpgsql/src/pl_comp.c
+++ b/src/pl/plpgsql/src/pl_comp.c
@@ -19,7 +19,6 @@
#include "pl.tab.h"
-#include "access/heapam.h"
#include "catalog/namespace.h"
#include "catalog/pg_attrdef.h"
#include "catalog/pg_attribute.h"
diff --git a/src/pl/plpgsql/src/pl_exec.c b/src/pl/plpgsql/src/pl_exec.c
index d8cd966230..8335ef0989 100644
--- a/src/pl/plpgsql/src/pl_exec.c
+++ b/src/pl/plpgsql/src/pl_exec.c
@@ -18,7 +18,6 @@
#include <ctype.h>
-#include "access/heapam.h"
#include "access/transam.h"
#include "catalog/pg_proc.h"
#include "catalog/pg_type.h"
diff --git a/src/pl/plpgsql/src/pl_handler.c b/src/pl/plpgsql/src/pl_handler.c
index 90245f0a66..6d209ad940 100644
--- a/src/pl/plpgsql/src/pl_handler.c
+++ b/src/pl/plpgsql/src/pl_handler.c
@@ -16,7 +16,6 @@
#include "plpgsql.h"
#include "pl.tab.h"
-#include "access/heapam.h"
#include "catalog/pg_proc.h"
#include "catalog/pg_type.h"
#include "funcapi.h"
diff --git a/src/pl/plpython/plpython.c b/src/pl/plpython/plpython.c
index 5dbad82114..54771cbb95 100644
--- a/src/pl/plpython/plpython.c
+++ b/src/pl/plpython/plpython.c
@@ -48,7 +48,6 @@ typedef int Py_ssize_t;
#include <fcntl.h>
/* postgreSQL stuff */
-#include "access/heapam.h"
#include "catalog/pg_proc.h"
#include "catalog/pg_type.h"
#include "commands/trigger.h"
diff --git a/src/pl/tcl/pltcl.c b/src/pl/tcl/pltcl.c
index 5420722381..e41b0e2de4 100644
--- a/src/pl/tcl/pltcl.c
+++ b/src/pl/tcl/pltcl.c
@@ -18,7 +18,6 @@
#define CONST84
#endif
-#include "access/heapam.h"
#include "catalog/pg_language.h"
#include "catalog/pg_proc.h"
#include "commands/trigger.h"