aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/backend/access/common/reloptions.c1
-rw-r--r--src/backend/access/common/tupconvert.c1
-rw-r--r--src/backend/access/common/tupdesc.c1
-rw-r--r--src/backend/access/heap/hio.c1
-rw-r--r--src/backend/access/heap/pruneheap.c1
-rw-r--r--src/backend/access/transam/twophase.c2
-rw-r--r--src/backend/access/transam/xlogfuncs.c1
-rw-r--r--src/backend/bootstrap/bootstrap.c1
-rw-r--r--src/backend/catalog/aclchk.c1
-rw-r--r--src/backend/catalog/dependency.c1
-rw-r--r--src/backend/catalog/heap.c1
-rw-r--r--src/backend/catalog/indexing.c1
-rw-r--r--src/backend/catalog/namespace.c1
-rw-r--r--src/backend/catalog/objectaddress.c1
-rw-r--r--src/backend/catalog/pg_aggregate.c1
-rw-r--r--src/backend/catalog/pg_collation.c1
-rw-r--r--src/backend/catalog/pg_constraint.c1
-rw-r--r--src/backend/catalog/pg_conversion.c1
-rw-r--r--src/backend/catalog/pg_db_role_setting.c1
-rw-r--r--src/backend/catalog/pg_depend.c1
-rw-r--r--src/backend/catalog/pg_enum.c1
-rw-r--r--src/backend/catalog/pg_inherits.c1
-rw-r--r--src/backend/catalog/pg_largeobject.c1
-rw-r--r--src/backend/catalog/pg_namespace.c1
-rw-r--r--src/backend/catalog/pg_operator.c1
-rw-r--r--src/backend/catalog/pg_proc.c1
-rw-r--r--src/backend/catalog/pg_range.c1
-rw-r--r--src/backend/catalog/pg_shdepend.c1
-rw-r--r--src/backend/catalog/pg_type.c1
-rw-r--r--src/backend/commands/aggregatecmds.c1
-rw-r--r--src/backend/commands/alter.c1
-rw-r--r--src/backend/commands/collationcmds.c1
-rw-r--r--src/backend/commands/comment.c1
-rw-r--r--src/backend/commands/conversioncmds.c1
-rw-r--r--src/backend/commands/copy.c1
-rw-r--r--src/backend/commands/createas.c1
-rw-r--r--src/backend/commands/dbcommands.c1
-rw-r--r--src/backend/commands/dropcmds.c1
-rw-r--r--src/backend/commands/event_trigger.c1
-rw-r--r--src/backend/commands/extension.c1
-rw-r--r--src/backend/commands/foreigncmds.c1
-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/operatorcmds.c1
-rw-r--r--src/backend/commands/proclang.c1
-rw-r--r--src/backend/commands/schemacmds.c1
-rw-r--r--src/backend/commands/seclabel.c1
-rw-r--r--src/backend/commands/sequence.c1
-rw-r--r--src/backend/commands/tablespace.c1
-rw-r--r--src/backend/commands/trigger.c1
-rw-r--r--src/backend/commands/tsearchcmds.c3
-rw-r--r--src/backend/commands/typecmds.c1
-rw-r--r--src/backend/commands/user.c1
-rw-r--r--src/backend/commands/vacuum.c1
-rw-r--r--src/backend/commands/vacuumlazy.c1
-rw-r--r--src/backend/commands/variable.c1
-rw-r--r--src/backend/executor/execAmi.c1
-rw-r--r--src/backend/executor/execMain.c1
-rw-r--r--src/backend/executor/execQual.c1
-rw-r--r--src/backend/executor/execTuples.c1
-rw-r--r--src/backend/executor/functions.c1
-rw-r--r--src/backend/executor/nodeAgg.c1
-rw-r--r--src/backend/executor/nodeHash.c1
-rw-r--r--src/backend/executor/nodeHashjoin.c1
-rw-r--r--src/backend/executor/nodeLockRows.c1
-rw-r--r--src/backend/executor/nodeModifyTable.c1
-rw-r--r--src/backend/executor/nodeSetOp.c1
-rw-r--r--src/backend/executor/nodeSubplan.c1
-rw-r--r--src/backend/executor/nodeWindowAgg.c1
-rw-r--r--src/backend/executor/spi.c1
-rw-r--r--src/backend/foreign/foreign.c1
-rw-r--r--src/backend/nodes/tidbitmap.c2
-rw-r--r--src/backend/optimizer/path/costsize.c1
-rw-r--r--src/backend/optimizer/plan/planagg.c1
-rw-r--r--src/backend/optimizer/plan/planner.c1
-rw-r--r--src/backend/optimizer/plan/subselect.c1
-rw-r--r--src/backend/optimizer/prep/prepunion.c1
-rw-r--r--src/backend/optimizer/util/clauses.c1
-rw-r--r--src/backend/optimizer/util/plancat.c1
-rw-r--r--src/backend/parser/parse_coerce.c1
-rw-r--r--src/backend/parser/parse_func.c1
-rw-r--r--src/backend/parser/parse_node.c1
-rw-r--r--src/backend/parser/parse_oper.c1
-rw-r--r--src/backend/parser/parse_relation.c1
-rw-r--r--src/backend/parser/parse_type.c1
-rw-r--r--src/backend/parser/parse_utilcmd.c1
-rw-r--r--src/backend/postmaster/autovacuum.c1
-rw-r--r--src/backend/postmaster/pgstat.c1
-rw-r--r--src/backend/rewrite/rewriteDefine.c1
-rw-r--r--src/backend/rewrite/rewriteRemove.c1
-rw-r--r--src/backend/rewrite/rewriteSupport.c1
-rw-r--r--src/backend/storage/freespace/freespace.c2
-rw-r--r--src/backend/storage/lmgr/predicate.c1
-rw-r--r--src/backend/storage/page/bufpage.c2
-rw-r--r--src/backend/tcop/fastpath.c1
-rw-r--r--src/backend/tcop/utility.c1
-rw-r--r--src/backend/tsearch/ts_selfuncs.c1
-rw-r--r--src/backend/utils/adt/acl.c1
-rw-r--r--src/backend/utils/adt/array_selfuncs.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/dbsize.c1
-rw-r--r--src/backend/utils/adt/enum.c1
-rw-r--r--src/backend/utils/adt/format_type.c1
-rw-r--r--src/backend/utils/adt/genfile.c1
-rw-r--r--src/backend/utils/adt/json.c1
-rw-r--r--src/backend/utils/adt/lockfuncs.c1
-rw-r--r--src/backend/utils/adt/pg_locale.c1
-rw-r--r--src/backend/utils/adt/pgstatfuncs.c1
-rw-r--r--src/backend/utils/adt/rangetypes_selfuncs.c1
-rw-r--r--src/backend/utils/adt/regproc.c1
-rw-r--r--src/backend/utils/adt/ri_triggers.c3
-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/trigfuncs.c1
-rw-r--r--src/backend/utils/adt/varbit.c2
-rw-r--r--src/backend/utils/adt/xml.c1
-rw-r--r--src/backend/utils/cache/evtcache.c1
-rw-r--r--src/backend/utils/cache/inval.c1
-rw-r--r--src/backend/utils/cache/lsyscache.c1
-rw-r--r--src/backend/utils/cache/relcache.c1
-rw-r--r--src/backend/utils/cache/syscache.c1
-rw-r--r--src/backend/utils/cache/ts_cache.c1
-rw-r--r--src/backend/utils/cache/typcache.c1
-rw-r--r--src/backend/utils/fmgr/funcapi.c1
-rw-r--r--src/backend/utils/init/miscinit.c1
-rw-r--r--src/backend/utils/init/postinit.c1
-rw-r--r--src/backend/utils/misc/superuser.c1
-rw-r--r--src/backend/utils/sort/tuplesort.c1
-rw-r--r--src/backend/utils/sort/tuplestore.c1
-rw-r--r--src/backend/utils/time/combocid.c2
-rw-r--r--src/backend/utils/time/tqual.c1
-rw-r--r--src/include/access/heapam.h1
-rw-r--r--src/include/access/heapam_xlog.h1
-rw-r--r--src/include/access/htup.h632
-rw-r--r--src/include/access/htup_details.h657
-rw-r--r--src/include/access/reloptions.h1
-rw-r--r--src/include/access/relscan.h1
-rw-r--r--src/include/access/tupconvert.h1
-rw-r--r--src/include/access/tuptoaster.h2
-rw-r--r--src/include/executor/tuptable.h1
-rw-r--r--src/include/utils/inval.h1
-rw-r--r--src/include/utils/lsyscache.h2
-rw-r--r--src/pl/plperl/plperl.c1
-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/plpy_exec.c1
-rw-r--r--src/pl/plpython/plpy_main.c1
-rw-r--r--src/pl/plpython/plpy_procedure.c1
-rw-r--r--src/pl/plpython/plpy_spi.c1
-rw-r--r--src/pl/plpython/plpy_typeio.c1
-rw-r--r--src/pl/plpython/plpy_typeio.h1
-rw-r--r--src/pl/tcl/pltcl.c1
156 files changed, 817 insertions, 638 deletions
diff --git a/src/backend/access/common/reloptions.c b/src/backend/access/common/reloptions.c
index 1eeaadecffe..bc6911e4960 100644
--- a/src/backend/access/common/reloptions.c
+++ b/src/backend/access/common/reloptions.c
@@ -17,6 +17,7 @@
#include "access/gist_private.h"
#include "access/hash.h"
+#include "access/htup_details.h"
#include "access/nbtree.h"
#include "access/reloptions.h"
#include "access/spgist.h"
diff --git a/src/backend/access/common/tupconvert.c b/src/backend/access/common/tupconvert.c
index f5a43d47b88..f813432c7d5 100644
--- a/src/backend/access/common/tupconvert.c
+++ b/src/backend/access/common/tupconvert.c
@@ -20,6 +20,7 @@
*/
#include "postgres.h"
+#include "access/htup_details.h"
#include "access/tupconvert.h"
#include "utils/builtins.h"
diff --git a/src/backend/access/common/tupdesc.c b/src/backend/access/common/tupdesc.c
index 99d0d1802ce..2f10910b823 100644
--- a/src/backend/access/common/tupdesc.c
+++ b/src/backend/access/common/tupdesc.c
@@ -19,6 +19,7 @@
#include "postgres.h"
+#include "access/htup_details.h"
#include "catalog/pg_type.h"
#include "miscadmin.h"
#include "parser/parse_type.h"
diff --git a/src/backend/access/heap/hio.c b/src/backend/access/heap/hio.c
index 19a34923c7a..c08047e02b7 100644
--- a/src/backend/access/heap/hio.c
+++ b/src/backend/access/heap/hio.c
@@ -17,6 +17,7 @@
#include "access/heapam.h"
#include "access/hio.h"
+#include "access/htup_details.h"
#include "access/visibilitymap.h"
#include "storage/bufmgr.h"
#include "storage/freespace.h"
diff --git a/src/backend/access/heap/pruneheap.c b/src/backend/access/heap/pruneheap.c
index e0209c9aeaf..97a2868f194 100644
--- a/src/backend/access/heap/pruneheap.c
+++ b/src/backend/access/heap/pruneheap.c
@@ -17,6 +17,7 @@
#include "access/heapam.h"
#include "access/heapam_xlog.h"
#include "access/transam.h"
+#include "access/htup_details.h"
#include "miscadmin.h"
#include "pgstat.h"
#include "storage/bufmgr.h"
diff --git a/src/backend/access/transam/twophase.c b/src/backend/access/transam/twophase.c
index 2a60c62dd4d..29a2ee6d393 100644
--- a/src/backend/access/transam/twophase.c
+++ b/src/backend/access/transam/twophase.c
@@ -41,7 +41,7 @@
#include <time.h>
#include <unistd.h>
-#include "access/htup.h"
+#include "access/htup_details.h"
#include "access/subtrans.h"
#include "access/transam.h"
#include "access/twophase.h"
diff --git a/src/backend/access/transam/xlogfuncs.c b/src/backend/access/transam/xlogfuncs.c
index 6a446e96889..d3457615986 100644
--- a/src/backend/access/transam/xlogfuncs.c
+++ b/src/backend/access/transam/xlogfuncs.c
@@ -16,6 +16,7 @@
*/
#include "postgres.h"
+#include "access/htup_details.h"
#include "access/xlog.h"
#include "access/xlog_internal.h"
#include "access/xlogutils.h"
diff --git a/src/backend/bootstrap/bootstrap.c b/src/backend/bootstrap/bootstrap.c
index b7428829f37..34ddebbc0b9 100644
--- a/src/backend/bootstrap/bootstrap.c
+++ b/src/backend/bootstrap/bootstrap.c
@@ -21,6 +21,7 @@
#include <getopt.h>
#endif
+#include "access/htup_details.h"
#include "bootstrap/bootstrap.h"
#include "catalog/index.h"
#include "catalog/pg_collation.h"
diff --git a/src/backend/catalog/aclchk.c b/src/backend/catalog/aclchk.c
index b097813a063..4e4c7af4c47 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/htup_details.h"
#include "access/sysattr.h"
#include "access/xact.h"
#include "catalog/catalog.h"
diff --git a/src/backend/catalog/dependency.c b/src/backend/catalog/dependency.c
index 7d07c56cd0b..87d6f024214 100644
--- a/src/backend/catalog/dependency.c
+++ b/src/backend/catalog/dependency.c
@@ -14,6 +14,7 @@
*/
#include "postgres.h"
+#include "access/htup_details.h"
#include "access/sysattr.h"
#include "access/xact.h"
#include "catalog/dependency.h"
diff --git a/src/backend/catalog/heap.c b/src/backend/catalog/heap.c
index a08830121f6..c80df418faf 100644
--- a/src/backend/catalog/heap.c
+++ b/src/backend/catalog/heap.c
@@ -29,6 +29,7 @@
*/
#include "postgres.h"
+#include "access/htup_details.h"
#include "access/sysattr.h"
#include "access/transam.h"
#include "access/xact.h"
diff --git a/src/backend/catalog/indexing.c b/src/backend/catalog/indexing.c
index ee049857a2f..ce367ac308e 100644
--- a/src/backend/catalog/indexing.c
+++ b/src/backend/catalog/indexing.c
@@ -15,6 +15,7 @@
*/
#include "postgres.h"
+#include "access/htup_details.h"
#include "catalog/index.h"
#include "catalog/indexing.h"
#include "executor/executor.h"
diff --git a/src/backend/catalog/namespace.c b/src/backend/catalog/namespace.c
index 10ad82b79e9..b559f5533b3 100644
--- a/src/backend/catalog/namespace.c
+++ b/src/backend/catalog/namespace.c
@@ -19,6 +19,7 @@
*/
#include "postgres.h"
+#include "access/htup_details.h"
#include "access/xact.h"
#include "catalog/dependency.h"
#include "catalog/pg_authid.h"
diff --git a/src/backend/catalog/objectaddress.c b/src/backend/catalog/objectaddress.c
index 5b8140b0ae7..c1e5e1db777 100644
--- a/src/backend/catalog/objectaddress.c
+++ b/src/backend/catalog/objectaddress.c
@@ -15,6 +15,7 @@
#include "postgres.h"
+#include "access/htup_details.h"
#include "access/sysattr.h"
#include "catalog/catalog.h"
#include "catalog/indexing.h"
diff --git a/src/backend/catalog/pg_aggregate.c b/src/backend/catalog/pg_aggregate.c
index 403c6f03a63..2e12c5a3d54 100644
--- a/src/backend/catalog/pg_aggregate.c
+++ b/src/backend/catalog/pg_aggregate.c
@@ -15,6 +15,7 @@
#include "postgres.h"
#include "access/heapam.h"
+#include "access/htup_details.h"
#include "catalog/dependency.h"
#include "catalog/indexing.h"
#include "catalog/pg_aggregate.h"
diff --git a/src/backend/catalog/pg_collation.c b/src/backend/catalog/pg_collation.c
index 18c7acf0e81..6020d16c74d 100644
--- a/src/backend/catalog/pg_collation.c
+++ b/src/backend/catalog/pg_collation.c
@@ -16,6 +16,7 @@
#include "access/genam.h"
#include "access/heapam.h"
+#include "access/htup_details.h"
#include "access/sysattr.h"
#include "catalog/dependency.h"
#include "catalog/indexing.h"
diff --git a/src/backend/catalog/pg_constraint.c b/src/backend/catalog/pg_constraint.c
index 224859d76e7..8df3f18e300 100644
--- a/src/backend/catalog/pg_constraint.c
+++ b/src/backend/catalog/pg_constraint.c
@@ -16,6 +16,7 @@
#include "access/genam.h"
#include "access/heapam.h"
+#include "access/htup_details.h"
#include "catalog/dependency.h"
#include "catalog/indexing.h"
#include "catalog/objectaccess.h"
diff --git a/src/backend/catalog/pg_conversion.c b/src/backend/catalog/pg_conversion.c
index 358bd39bb05..68f1aa76e21 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/htup_details.h"
#include "access/sysattr.h"
#include "catalog/dependency.h"
#include "catalog/indexing.h"
diff --git a/src/backend/catalog/pg_db_role_setting.c b/src/backend/catalog/pg_db_role_setting.c
index d865b6875d3..616980ce89b 100644
--- a/src/backend/catalog/pg_db_role_setting.c
+++ b/src/backend/catalog/pg_db_role_setting.c
@@ -12,6 +12,7 @@
#include "access/genam.h"
#include "access/heapam.h"
+#include "access/htup_details.h"
#include "catalog/indexing.h"
#include "catalog/pg_db_role_setting.h"
#include "utils/fmgroids.h"
diff --git a/src/backend/catalog/pg_depend.c b/src/backend/catalog/pg_depend.c
index 8e584356064..9a5931692f2 100644
--- a/src/backend/catalog/pg_depend.c
+++ b/src/backend/catalog/pg_depend.c
@@ -16,6 +16,7 @@
#include "access/genam.h"
#include "access/heapam.h"
+#include "access/htup_details.h"
#include "catalog/dependency.h"
#include "catalog/indexing.h"
#include "catalog/pg_constraint.h"
diff --git a/src/backend/catalog/pg_enum.c b/src/backend/catalog/pg_enum.c
index 20e26c47ca4..8ddb376bc16 100644
--- a/src/backend/catalog/pg_enum.c
+++ b/src/backend/catalog/pg_enum.c
@@ -15,6 +15,7 @@
#include "access/genam.h"
#include "access/heapam.h"
+#include "access/htup_details.h"
#include "access/xact.h"
#include "catalog/catalog.h"
#include "catalog/indexing.h"
diff --git a/src/backend/catalog/pg_inherits.c b/src/backend/catalog/pg_inherits.c
index 146c845c94f..d34fed85f8b 100644
--- a/src/backend/catalog/pg_inherits.c
+++ b/src/backend/catalog/pg_inherits.c
@@ -21,6 +21,7 @@
#include "access/genam.h"
#include "access/heapam.h"
+#include "access/htup_details.h"
#include "catalog/indexing.h"
#include "catalog/pg_inherits.h"
#include "catalog/pg_inherits_fn.h"
diff --git a/src/backend/catalog/pg_largeobject.c b/src/backend/catalog/pg_largeobject.c
index 1e5de6acad9..33220341401 100644
--- a/src/backend/catalog/pg_largeobject.c
+++ b/src/backend/catalog/pg_largeobject.c
@@ -16,6 +16,7 @@
#include "access/genam.h"
#include "access/heapam.h"
+#include "access/htup_details.h"
#include "access/sysattr.h"
#include "catalog/dependency.h"
#include "catalog/indexing.h"
diff --git a/src/backend/catalog/pg_namespace.c b/src/backend/catalog/pg_namespace.c
index de856760f08..098df224a8d 100644
--- a/src/backend/catalog/pg_namespace.c
+++ b/src/backend/catalog/pg_namespace.c
@@ -15,6 +15,7 @@
#include "postgres.h"
#include "access/heapam.h"
+#include "access/htup_details.h"
#include "catalog/dependency.h"
#include "catalog/indexing.h"
#include "catalog/objectaccess.h"
diff --git a/src/backend/catalog/pg_operator.c b/src/backend/catalog/pg_operator.c
index 4fd55ae5706..88af345fab9 100644
--- a/src/backend/catalog/pg_operator.c
+++ b/src/backend/catalog/pg_operator.c
@@ -18,6 +18,7 @@
#include "postgres.h"
#include "access/heapam.h"
+#include "access/htup_details.h"
#include "access/xact.h"
#include "catalog/dependency.h"
#include "catalog/indexing.h"
diff --git a/src/backend/catalog/pg_proc.c b/src/backend/catalog/pg_proc.c
index ac53b09af6b..ba73264c60c 100644
--- a/src/backend/catalog/pg_proc.c
+++ b/src/backend/catalog/pg_proc.c
@@ -14,6 +14,7 @@
*/
#include "postgres.h"
+#include "access/htup_details.h"
#include "access/xact.h"
#include "catalog/dependency.h"
#include "catalog/indexing.h"
diff --git a/src/backend/catalog/pg_range.c b/src/backend/catalog/pg_range.c
index 7e52d0d0175..a24df23fbf8 100644
--- a/src/backend/catalog/pg_range.c
+++ b/src/backend/catalog/pg_range.c
@@ -16,6 +16,7 @@
#include "access/genam.h"
#include "access/heapam.h"
+#include "access/htup_details.h"
#include "catalog/dependency.h"
#include "catalog/indexing.h"
#include "catalog/pg_collation.h"
diff --git a/src/backend/catalog/pg_shdepend.c b/src/backend/catalog/pg_shdepend.c
index 23111eccc5d..5a73b48ea76 100644
--- a/src/backend/catalog/pg_shdepend.c
+++ b/src/backend/catalog/pg_shdepend.c
@@ -16,6 +16,7 @@
#include "access/genam.h"
#include "access/heapam.h"
+#include "access/htup_details.h"
#include "access/xact.h"
#include "catalog/catalog.h"
#include "catalog/dependency.h"
diff --git a/src/backend/catalog/pg_type.c b/src/backend/catalog/pg_type.c
index 6062926e604..49133eee8c6 100644
--- a/src/backend/catalog/pg_type.c
+++ b/src/backend/catalog/pg_type.c
@@ -15,6 +15,7 @@
#include "postgres.h"
#include "access/heapam.h"
+#include "access/htup_details.h"
#include "access/xact.h"
#include "catalog/dependency.h"
#include "catalog/indexing.h"
diff --git a/src/backend/commands/aggregatecmds.c b/src/backend/commands/aggregatecmds.c
index c0dcdf7ac56..57adfe8a9ae 100644
--- a/src/backend/commands/aggregatecmds.c
+++ b/src/backend/commands/aggregatecmds.c
@@ -23,6 +23,7 @@
#include "postgres.h"
#include "access/heapam.h"
+#include "access/htup_details.h"
#include "catalog/dependency.h"
#include "catalog/indexing.h"
#include "catalog/pg_aggregate.h"
diff --git a/src/backend/commands/alter.c b/src/backend/commands/alter.c
index 19f989549c7..e5b813d19a0 100644
--- a/src/backend/commands/alter.c
+++ b/src/backend/commands/alter.c
@@ -14,6 +14,7 @@
*/
#include "postgres.h"
+#include "access/htup_details.h"
#include "catalog/dependency.h"
#include "catalog/indexing.h"
#include "catalog/namespace.h"
diff --git a/src/backend/commands/collationcmds.c b/src/backend/commands/collationcmds.c
index e574288c2c5..ad7528828bd 100644
--- a/src/backend/commands/collationcmds.c
+++ b/src/backend/commands/collationcmds.c
@@ -15,6 +15,7 @@
#include "postgres.h"
#include "access/heapam.h"
+#include "access/htup_details.h"
#include "access/xact.h"
#include "catalog/dependency.h"
#include "catalog/indexing.h"
diff --git a/src/backend/commands/comment.c b/src/backend/commands/comment.c
index 7ea367571e6..267694f5b9a 100644
--- a/src/backend/commands/comment.c
+++ b/src/backend/commands/comment.c
@@ -16,6 +16,7 @@
#include "access/genam.h"
#include "access/heapam.h"
+#include "access/htup_details.h"
#include "catalog/indexing.h"
#include "catalog/objectaddress.h"
#include "catalog/pg_description.h"
diff --git a/src/backend/commands/conversioncmds.c b/src/backend/commands/conversioncmds.c
index aad7e46261e..e36c91ade19 100644
--- a/src/backend/commands/conversioncmds.c
+++ b/src/backend/commands/conversioncmds.c
@@ -15,6 +15,7 @@
#include "postgres.h"
#include "access/heapam.h"
+#include "access/htup_details.h"
#include "catalog/dependency.h"
#include "catalog/indexing.h"
#include "catalog/pg_conversion.h"
diff --git a/src/backend/commands/copy.c b/src/backend/commands/copy.c
index e8a125b1a58..0567ab003d4 100644
--- a/src/backend/commands/copy.c
+++ b/src/backend/commands/copy.c
@@ -21,6 +21,7 @@
#include <arpa/inet.h>
#include "access/heapam.h"
+#include "access/htup_details.h"
#include "access/sysattr.h"
#include "access/xact.h"
#include "catalog/namespace.h"
diff --git a/src/backend/commands/createas.c b/src/backend/commands/createas.c
index dc0665e2a41..07ee6b30914 100644
--- a/src/backend/commands/createas.c
+++ b/src/backend/commands/createas.c
@@ -22,6 +22,7 @@
#include "postgres.h"
#include "access/reloptions.h"
+#include "access/htup_details.h"
#include "access/sysattr.h"
#include "access/xact.h"
#include "catalog/toasting.h"
diff --git a/src/backend/commands/dbcommands.c b/src/backend/commands/dbcommands.c
index 21925731738..cdbce97c4ff 100644
--- a/src/backend/commands/dbcommands.c
+++ b/src/backend/commands/dbcommands.c
@@ -26,6 +26,7 @@
#include "access/genam.h"
#include "access/heapam.h"
+#include "access/htup_details.h"
#include "access/xact.h"
#include "access/xlogutils.h"
#include "catalog/catalog.h"
diff --git a/src/backend/commands/dropcmds.c b/src/backend/commands/dropcmds.c
index 8f5d7e0ed2b..1a569d91ece 100644
--- a/src/backend/commands/dropcmds.c
+++ b/src/backend/commands/dropcmds.c
@@ -16,6 +16,7 @@
#include "postgres.h"
#include "access/heapam.h"
+#include "access/htup_details.h"
#include "catalog/dependency.h"
#include "catalog/namespace.h"
#include "catalog/objectaddress.h"
diff --git a/src/backend/commands/event_trigger.c b/src/backend/commands/event_trigger.c
index d725360b864..cb4e658a584 100644
--- a/src/backend/commands/event_trigger.c
+++ b/src/backend/commands/event_trigger.c
@@ -13,6 +13,7 @@
*/
#include "postgres.h"
+#include "access/htup_details.h"
#include "access/xact.h"
#include "catalog/dependency.h"
#include "catalog/indexing.h"
diff --git a/src/backend/commands/extension.c b/src/backend/commands/extension.c
index 0901601fb7e..ec8aa178923 100644
--- a/src/backend/commands/extension.c
+++ b/src/backend/commands/extension.c
@@ -27,6 +27,7 @@
#include <limits.h>
#include <unistd.h>
+#include "access/htup_details.h"
#include "access/sysattr.h"
#include "access/xact.h"
#include "catalog/dependency.h"
diff --git a/src/backend/commands/foreigncmds.c b/src/backend/commands/foreigncmds.c
index 342ecc29318..f10cb5252d9 100644
--- a/src/backend/commands/foreigncmds.c
+++ b/src/backend/commands/foreigncmds.c
@@ -14,6 +14,7 @@
#include "postgres.h"
#include "access/heapam.h"
+#include "access/htup_details.h"
#include "access/xact.h"
#include "access/reloptions.h"
#include "catalog/dependency.h"
diff --git a/src/backend/commands/functioncmds.c b/src/backend/commands/functioncmds.c
index dcadb3dc84a..bf040730fa0 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/htup_details.h"
#include "access/sysattr.h"
#include "catalog/dependency.h"
#include "catalog/indexing.h"
diff --git a/src/backend/commands/indexcmds.c b/src/backend/commands/indexcmds.c
index f6772686091..a58101ec6e5 100644
--- a/src/backend/commands/indexcmds.c
+++ b/src/backend/commands/indexcmds.c
@@ -15,6 +15,7 @@
#include "postgres.h"
+#include "access/htup_details.h"
#include "access/reloptions.h"
#include "access/xact.h"
#include "catalog/catalog.h"
diff --git a/src/backend/commands/opclasscmds.c b/src/backend/commands/opclasscmds.c
index f5642447f12..7cf4db05115 100644
--- a/src/backend/commands/opclasscmds.c
+++ b/src/backend/commands/opclasscmds.c
@@ -20,6 +20,7 @@
#include "access/genam.h"
#include "access/heapam.h"
#include "access/nbtree.h"
+#include "access/htup_details.h"
#include "access/sysattr.h"
#include "catalog/dependency.h"
#include "catalog/indexing.h"
diff --git a/src/backend/commands/operatorcmds.c b/src/backend/commands/operatorcmds.c
index 410c708975f..e0ac0e113b4 100644
--- a/src/backend/commands/operatorcmds.c
+++ b/src/backend/commands/operatorcmds.c
@@ -35,6 +35,7 @@
#include "postgres.h"
#include "access/heapam.h"
+#include "access/htup_details.h"
#include "catalog/dependency.h"
#include "catalog/indexing.h"
#include "catalog/pg_operator.h"
diff --git a/src/backend/commands/proclang.c b/src/backend/commands/proclang.c
index 354389c617f..31139bdcb95 100644
--- a/src/backend/commands/proclang.c
+++ b/src/backend/commands/proclang.c
@@ -15,6 +15,7 @@
#include "access/genam.h"
#include "access/heapam.h"
+#include "access/htup_details.h"
#include "catalog/dependency.h"
#include "catalog/indexing.h"
#include "catalog/objectaccess.h"
diff --git a/src/backend/commands/schemacmds.c b/src/backend/commands/schemacmds.c
index 4974025cc33..b11c38d0b8b 100644
--- a/src/backend/commands/schemacmds.c
+++ b/src/backend/commands/schemacmds.c
@@ -14,6 +14,7 @@
*/
#include "postgres.h"
+#include "access/htup_details.h"
#include "access/xact.h"
#include "catalog/catalog.h"
#include "catalog/dependency.h"
diff --git a/src/backend/commands/seclabel.c b/src/backend/commands/seclabel.c
index c09a96e9f6c..91f41a1cd70 100644
--- a/src/backend/commands/seclabel.c
+++ b/src/backend/commands/seclabel.c
@@ -12,6 +12,7 @@
#include "access/genam.h"
#include "access/heapam.h"
+#include "access/htup_details.h"
#include "catalog/catalog.h"
#include "catalog/indexing.h"
#include "catalog/pg_seclabel.h"
diff --git a/src/backend/commands/sequence.c b/src/backend/commands/sequence.c
index fbb6489915e..4f55830ae4d 100644
--- a/src/backend/commands/sequence.c
+++ b/src/backend/commands/sequence.c
@@ -15,6 +15,7 @@
#include "postgres.h"
#include "access/transam.h"
+#include "access/htup_details.h"
#include "access/xlogutils.h"
#include "catalog/dependency.h"
#include "catalog/namespace.h"
diff --git a/src/backend/commands/tablespace.c b/src/backend/commands/tablespace.c
index da9cb2f30e9..d1718c15138 100644
--- a/src/backend/commands/tablespace.c
+++ b/src/backend/commands/tablespace.c
@@ -53,6 +53,7 @@
#include "access/heapam.h"
#include "access/reloptions.h"
+#include "access/htup_details.h"
#include "access/sysattr.h"
#include "access/xact.h"
#include "catalog/catalog.h"
diff --git a/src/backend/commands/trigger.c b/src/backend/commands/trigger.c
index e7576fc9ea9..4d3ed9cb62c 100644
--- a/src/backend/commands/trigger.c
+++ b/src/backend/commands/trigger.c
@@ -16,6 +16,7 @@
#include "access/genam.h"
#include "access/heapam.h"
#include "access/sysattr.h"
+#include "access/htup_details.h"
#include "access/xact.h"
#include "catalog/catalog.h"
#include "catalog/dependency.h"
diff --git a/src/backend/commands/tsearchcmds.c b/src/backend/commands/tsearchcmds.c
index 86cb8704da8..487c7fb1a25 100644
--- a/src/backend/commands/tsearchcmds.c
+++ b/src/backend/commands/tsearchcmds.c
@@ -17,8 +17,9 @@
#include <ctype.h>
-#include "access/heapam.h"
#include "access/genam.h"
+#include "access/heapam.h"
+#include "access/htup_details.h"
#include "access/xact.h"
#include "catalog/dependency.h"
#include "catalog/indexing.h"
diff --git a/src/backend/commands/typecmds.c b/src/backend/commands/typecmds.c
index 7fc3ad7e736..88e4287492d 100644
--- a/src/backend/commands/typecmds.c
+++ b/src/backend/commands/typecmds.c
@@ -33,6 +33,7 @@
#include "access/genam.h"
#include "access/heapam.h"
+#include "access/htup_details.h"
#include "access/xact.h"
#include "catalog/catalog.h"
#include "catalog/dependency.h"
diff --git a/src/backend/commands/user.c b/src/backend/commands/user.c
index a22092c202c..f178167d629 100644
--- a/src/backend/commands/user.c
+++ b/src/backend/commands/user.c
@@ -14,6 +14,7 @@
#include "access/genam.h"
#include "access/heapam.h"
+#include "access/htup_details.h"
#include "access/xact.h"
#include "catalog/dependency.h"
#include "catalog/indexing.h"
diff --git a/src/backend/commands/vacuum.c b/src/backend/commands/vacuum.c
index 710c2afc9f3..14d1c08c973 100644
--- a/src/backend/commands/vacuum.c
+++ b/src/backend/commands/vacuum.c
@@ -25,6 +25,7 @@
#include "access/clog.h"
#include "access/genam.h"
#include "access/heapam.h"
+#include "access/htup_details.h"
#include "access/transam.h"
#include "access/xact.h"
#include "catalog/namespace.h"
diff --git a/src/backend/commands/vacuumlazy.c b/src/backend/commands/vacuumlazy.c
index 703b476bdfd..c9253a9c479 100644
--- a/src/backend/commands/vacuumlazy.c
+++ b/src/backend/commands/vacuumlazy.c
@@ -40,6 +40,7 @@
#include "access/genam.h"
#include "access/heapam.h"
#include "access/heapam_xlog.h"
+#include "access/htup_details.h"
#include "access/transam.h"
#include "access/visibilitymap.h"
#include "catalog/storage.h"
diff --git a/src/backend/commands/variable.c b/src/backend/commands/variable.c
index 5d894ba77f7..3b55e595af9 100644
--- a/src/backend/commands/variable.c
+++ b/src/backend/commands/variable.c
@@ -18,6 +18,7 @@
#include <ctype.h>
+#include "access/htup_details.h"
#include "access/xact.h"
#include "catalog/pg_authid.h"
#include "commands/variable.h"
diff --git a/src/backend/executor/execAmi.c b/src/backend/executor/execAmi.c
index e54d51e3d25..cf4943d8bed 100644
--- a/src/backend/executor/execAmi.c
+++ b/src/backend/executor/execAmi.c
@@ -12,6 +12,7 @@
*/
#include "postgres.h"
+#include "access/htup_details.h"
#include "executor/execdebug.h"
#include "executor/nodeAgg.h"
#include "executor/nodeAppend.h"
diff --git a/src/backend/executor/execMain.c b/src/backend/executor/execMain.c
index 440438b1807..d966be543e4 100644
--- a/src/backend/executor/execMain.c
+++ b/src/backend/executor/execMain.c
@@ -37,6 +37,7 @@
*/
#include "postgres.h"
+#include "access/htup_details.h"
#include "access/sysattr.h"
#include "access/transam.h"
#include "access/xact.h"
diff --git a/src/backend/executor/execQual.c b/src/backend/executor/execQual.c
index 85c8d15560f..56b106abda7 100644
--- a/src/backend/executor/execQual.c
+++ b/src/backend/executor/execQual.c
@@ -36,6 +36,7 @@
#include "postgres.h"
+#include "access/htup_details.h"
#include "access/nbtree.h"
#include "access/tupconvert.h"
#include "catalog/pg_type.h"
diff --git a/src/backend/executor/execTuples.c b/src/backend/executor/execTuples.c
index e755e7c4f07..530ddff4625 100644
--- a/src/backend/executor/execTuples.c
+++ b/src/backend/executor/execTuples.c
@@ -88,6 +88,7 @@
*/
#include "postgres.h"
+#include "access/htup_details.h"
#include "funcapi.h"
#include "catalog/pg_type.h"
#include "nodes/nodeFuncs.h"
diff --git a/src/backend/executor/functions.c b/src/backend/executor/functions.c
index fc0bcb4bced..c90521246a5 100644
--- a/src/backend/executor/functions.c
+++ b/src/backend/executor/functions.c
@@ -14,6 +14,7 @@
*/
#include "postgres.h"
+#include "access/htup_details.h"
#include "access/xact.h"
#include "catalog/pg_proc.h"
#include "catalog/pg_type.h"
diff --git a/src/backend/executor/nodeAgg.c b/src/backend/executor/nodeAgg.c
index c9aa9211036..38c71415fb5 100644
--- a/src/backend/executor/nodeAgg.c
+++ b/src/backend/executor/nodeAgg.c
@@ -78,6 +78,7 @@
#include "postgres.h"
+#include "access/htup_details.h"
#include "catalog/pg_aggregate.h"
#include "catalog/pg_proc.h"
#include "catalog/pg_type.h"
diff --git a/src/backend/executor/nodeHash.c b/src/backend/executor/nodeHash.c
index cabe663a964..c90fe40b3c9 100644
--- a/src/backend/executor/nodeHash.c
+++ b/src/backend/executor/nodeHash.c
@@ -24,6 +24,7 @@
#include <math.h>
#include <limits.h>
+#include "access/htup_details.h"
#include "catalog/pg_statistic.h"
#include "commands/tablespace.h"
#include "executor/execdebug.h"
diff --git a/src/backend/executor/nodeHashjoin.c b/src/backend/executor/nodeHashjoin.c
index 0ea490b5786..5bcf5f1f8be 100644
--- a/src/backend/executor/nodeHashjoin.c
+++ b/src/backend/executor/nodeHashjoin.c
@@ -15,6 +15,7 @@
#include "postgres.h"
+#include "access/htup_details.h"
#include "executor/executor.h"
#include "executor/hashjoin.h"
#include "executor/nodeHash.h"
diff --git a/src/backend/executor/nodeLockRows.c b/src/backend/executor/nodeLockRows.c
index d2a33cb3568..ec0825b460f 100644
--- a/src/backend/executor/nodeLockRows.c
+++ b/src/backend/executor/nodeLockRows.c
@@ -21,6 +21,7 @@
#include "postgres.h"
+#include "access/htup_details.h"
#include "access/xact.h"
#include "executor/executor.h"
#include "executor/nodeLockRows.h"
diff --git a/src/backend/executor/nodeModifyTable.c b/src/backend/executor/nodeModifyTable.c
index a7bce75f0cb..26a59d0121d 100644
--- a/src/backend/executor/nodeModifyTable.c
+++ b/src/backend/executor/nodeModifyTable.c
@@ -37,6 +37,7 @@
#include "postgres.h"
+#include "access/htup_details.h"
#include "access/xact.h"
#include "commands/trigger.h"
#include "executor/executor.h"
diff --git a/src/backend/executor/nodeSetOp.c b/src/backend/executor/nodeSetOp.c
index 362f4466e44..cd3e4e277ce 100644
--- a/src/backend/executor/nodeSetOp.c
+++ b/src/backend/executor/nodeSetOp.c
@@ -44,6 +44,7 @@
#include "postgres.h"
+#include "access/htup_details.h"
#include "executor/executor.h"
#include "executor/nodeSetOp.h"
#include "utils/memutils.h"
diff --git a/src/backend/executor/nodeSubplan.c b/src/backend/executor/nodeSubplan.c
index 474758140b6..d615b78373d 100644
--- a/src/backend/executor/nodeSubplan.c
+++ b/src/backend/executor/nodeSubplan.c
@@ -21,6 +21,7 @@
#include <limits.h>
#include <math.h>
+#include "access/htup_details.h"
#include "executor/executor.h"
#include "executor/nodeSubplan.h"
#include "nodes/makefuncs.h"
diff --git a/src/backend/executor/nodeWindowAgg.c b/src/backend/executor/nodeWindowAgg.c
index ce89ff2ebf9..ade9b57d287 100644
--- a/src/backend/executor/nodeWindowAgg.c
+++ b/src/backend/executor/nodeWindowAgg.c
@@ -33,6 +33,7 @@
*/
#include "postgres.h"
+#include "access/htup_details.h"
#include "catalog/pg_aggregate.h"
#include "catalog/pg_proc.h"
#include "catalog/pg_type.h"
diff --git a/src/backend/executor/spi.c b/src/backend/executor/spi.c
index 7c0da8873a7..70d60049050 100644
--- a/src/backend/executor/spi.c
+++ b/src/backend/executor/spi.c
@@ -14,6 +14,7 @@
*/
#include "postgres.h"
+#include "access/htup_details.h"
#include "access/printtup.h"
#include "access/sysattr.h"
#include "access/xact.h"
diff --git a/src/backend/foreign/foreign.c b/src/backend/foreign/foreign.c
index 6f9f77cc11f..d8845aa8974 100644
--- a/src/backend/foreign/foreign.c
+++ b/src/backend/foreign/foreign.c
@@ -12,6 +12,7 @@
*/
#include "postgres.h"
+#include "access/htup_details.h"
#include "access/reloptions.h"
#include "catalog/pg_foreign_data_wrapper.h"
#include "catalog/pg_foreign_server.h"
diff --git a/src/backend/nodes/tidbitmap.c b/src/backend/nodes/tidbitmap.c
index 728619e75da..202eacf4451 100644
--- a/src/backend/nodes/tidbitmap.c
+++ b/src/backend/nodes/tidbitmap.c
@@ -40,7 +40,7 @@
#include <limits.h>
-#include "access/htup.h"
+#include "access/htup_details.h"
#include "nodes/bitmapset.h"
#include "nodes/tidbitmap.h"
#include "utils/hsearch.h"
diff --git a/src/backend/optimizer/path/costsize.c b/src/backend/optimizer/path/costsize.c
index 223a0616fa0..3e99b230f5b 100644
--- a/src/backend/optimizer/path/costsize.c
+++ b/src/backend/optimizer/path/costsize.c
@@ -70,6 +70,7 @@
#include <math.h>
+#include "access/htup_details.h"
#include "executor/executor.h"
#include "executor/nodeHash.h"
#include "miscadmin.h"
diff --git a/src/backend/optimizer/plan/planagg.c b/src/backend/optimizer/plan/planagg.c
index 373f65b76fe..55a5ed7b4c6 100644
--- a/src/backend/optimizer/plan/planagg.c
+++ b/src/backend/optimizer/plan/planagg.c
@@ -28,6 +28,7 @@
*/
#include "postgres.h"
+#include "access/htup_details.h"
#include "catalog/pg_aggregate.h"
#include "catalog/pg_type.h"
#include "nodes/makefuncs.h"
diff --git a/src/backend/optimizer/plan/planner.c b/src/backend/optimizer/plan/planner.c
index 6170d48892e..0540afaced0 100644
--- a/src/backend/optimizer/plan/planner.c
+++ b/src/backend/optimizer/plan/planner.c
@@ -17,6 +17,7 @@
#include <limits.h>
+#include "access/htup_details.h"
#include "executor/executor.h"
#include "executor/nodeAgg.h"
#include "miscadmin.h"
diff --git a/src/backend/optimizer/plan/subselect.c b/src/backend/optimizer/plan/subselect.c
index 863c943f2a0..4c2e8212818 100644
--- a/src/backend/optimizer/plan/subselect.c
+++ b/src/backend/optimizer/plan/subselect.c
@@ -13,6 +13,7 @@
*/
#include "postgres.h"
+#include "access/htup_details.h"
#include "catalog/pg_operator.h"
#include "catalog/pg_type.h"
#include "executor/executor.h"
diff --git a/src/backend/optimizer/prep/prepunion.c b/src/backend/optimizer/prep/prepunion.c
index 2e50cb7548c..94373b087c3 100644
--- a/src/backend/optimizer/prep/prepunion.c
+++ b/src/backend/optimizer/prep/prepunion.c
@@ -31,6 +31,7 @@
#include <limits.h>
#include "access/heapam.h"
+#include "access/htup_details.h"
#include "access/sysattr.h"
#include "catalog/pg_inherits_fn.h"
#include "catalog/pg_type.h"
diff --git a/src/backend/optimizer/util/clauses.c b/src/backend/optimizer/util/clauses.c
index c339f132289..fa6817c9148 100644
--- a/src/backend/optimizer/util/clauses.c
+++ b/src/backend/optimizer/util/clauses.c
@@ -19,6 +19,7 @@
#include "postgres.h"
+#include "access/htup_details.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 71e1e73b0c6..25f8785b639 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/htup_details.h"
#include "access/sysattr.h"
#include "access/transam.h"
#include "access/xlog.h"
diff --git a/src/backend/parser/parse_coerce.c b/src/backend/parser/parse_coerce.c
index a1caf74fc53..f477730ad53 100644
--- a/src/backend/parser/parse_coerce.c
+++ b/src/backend/parser/parse_coerce.c
@@ -14,6 +14,7 @@
*/
#include "postgres.h"
+#include "access/htup_details.h"
#include "catalog/pg_cast.h"
#include "catalog/pg_class.h"
#include "catalog/pg_inherits_fn.h"
diff --git a/src/backend/parser/parse_func.c b/src/backend/parser/parse_func.c
index 2b1a13a693e..8bd88b022ff 100644
--- a/src/backend/parser/parse_func.c
+++ b/src/backend/parser/parse_func.c
@@ -14,6 +14,7 @@
*/
#include "postgres.h"
+#include "access/htup_details.h"
#include "catalog/pg_proc.h"
#include "catalog/pg_type.h"
#include "funcapi.h"
diff --git a/src/backend/parser/parse_node.c b/src/backend/parser/parse_node.c
index 6aaeae76b0a..2e9fad0f977 100644
--- a/src/backend/parser/parse_node.c
+++ b/src/backend/parser/parse_node.c
@@ -15,6 +15,7 @@
#include "postgres.h"
#include "access/heapam.h"
+#include "access/htup_details.h"
#include "catalog/pg_type.h"
#include "mb/pg_wchar.h"
#include "nodes/makefuncs.h"
diff --git a/src/backend/parser/parse_oper.c b/src/backend/parser/parse_oper.c
index bb5f04031d5..c92a976d24a 100644
--- a/src/backend/parser/parse_oper.c
+++ b/src/backend/parser/parse_oper.c
@@ -15,6 +15,7 @@
#include "postgres.h"
+#include "access/htup_details.h"
#include "catalog/pg_operator.h"
#include "catalog/pg_type.h"
#include "lib/stringinfo.h"
diff --git a/src/backend/parser/parse_relation.c b/src/backend/parser/parse_relation.c
index d9c73ae5a7c..36d95eb9ee9 100644
--- a/src/backend/parser/parse_relation.c
+++ b/src/backend/parser/parse_relation.c
@@ -16,6 +16,7 @@
#include <ctype.h>
+#include "access/htup_details.h"
#include "access/sysattr.h"
#include "catalog/heap.h"
#include "catalog/namespace.h"
diff --git a/src/backend/parser/parse_type.c b/src/backend/parser/parse_type.c
index cf2ff0cf70a..978ec7c9731 100644
--- a/src/backend/parser/parse_type.c
+++ b/src/backend/parser/parse_type.c
@@ -14,6 +14,7 @@
*/
#include "postgres.h"
+#include "access/htup_details.h"
#include "catalog/namespace.h"
#include "catalog/pg_type.h"
#include "lib/stringinfo.h"
diff --git a/src/backend/parser/parse_utilcmd.c b/src/backend/parser/parse_utilcmd.c
index accda01f457..95c57e81b58 100644
--- a/src/backend/parser/parse_utilcmd.c
+++ b/src/backend/parser/parse_utilcmd.c
@@ -26,6 +26,7 @@
#include "postgres.h"
+#include "access/htup_details.h"
#include "access/reloptions.h"
#include "catalog/dependency.h"
#include "catalog/heap.h"
diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c
index dd8690577cb..74db821387c 100644
--- a/src/backend/postmaster/autovacuum.c
+++ b/src/backend/postmaster/autovacuum.c
@@ -68,6 +68,7 @@
#include <unistd.h>
#include "access/heapam.h"
+#include "access/htup_details.h"
#include "access/reloptions.h"
#include "access/transam.h"
#include "access/xact.h"
diff --git a/src/backend/postmaster/pgstat.c b/src/backend/postmaster/pgstat.c
index 2371cd2ff9b..8389d5c4ae9 100644
--- a/src/backend/postmaster/pgstat.c
+++ b/src/backend/postmaster/pgstat.c
@@ -32,6 +32,7 @@
#include "pgstat.h"
#include "access/heapam.h"
+#include "access/htup_details.h"
#include "access/transam.h"
#include "access/twophase_rmgr.h"
#include "access/xact.h"
diff --git a/src/backend/rewrite/rewriteDefine.c b/src/backend/rewrite/rewriteDefine.c
index 971d277b769..8efc9fc9d52 100644
--- a/src/backend/rewrite/rewriteDefine.c
+++ b/src/backend/rewrite/rewriteDefine.c
@@ -15,6 +15,7 @@
#include "postgres.h"
#include "access/heapam.h"
+#include "access/htup_details.h"
#include "catalog/catalog.h"
#include "catalog/dependency.h"
#include "catalog/indexing.h"
diff --git a/src/backend/rewrite/rewriteRemove.c b/src/backend/rewrite/rewriteRemove.c
index 2c2e8fa08bf..c77591ab072 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/htup_details.h"
#include "access/sysattr.h"
#include "catalog/dependency.h"
#include "catalog/indexing.h"
diff --git a/src/backend/rewrite/rewriteSupport.c b/src/backend/rewrite/rewriteSupport.c
index 3f9b5e6063e..79b940fd214 100644
--- a/src/backend/rewrite/rewriteSupport.c
+++ b/src/backend/rewrite/rewriteSupport.c
@@ -15,6 +15,7 @@
#include "postgres.h"
#include "access/heapam.h"
+#include "access/htup_details.h"
#include "catalog/indexing.h"
#include "catalog/pg_rewrite.h"
#include "rewrite/rewriteSupport.h"
diff --git a/src/backend/storage/freespace/freespace.c b/src/backend/storage/freespace/freespace.c
index 7840adb3501..8889fe1ecbb 100644
--- a/src/backend/storage/freespace/freespace.c
+++ b/src/backend/storage/freespace/freespace.c
@@ -23,7 +23,7 @@
*/
#include "postgres.h"
-#include "access/htup.h"
+#include "access/htup_details.h"
#include "access/xlogutils.h"
#include "miscadmin.h"
#include "storage/freespace.h"
diff --git a/src/backend/storage/lmgr/predicate.c b/src/backend/storage/lmgr/predicate.c
index 8b5a95ceaa0..f164cfd3fea 100644
--- a/src/backend/storage/lmgr/predicate.c
+++ b/src/backend/storage/lmgr/predicate.c
@@ -183,6 +183,7 @@
#include "postgres.h"
+#include "access/htup_details.h"
#include "access/slru.h"
#include "access/subtrans.h"
#include "access/transam.h"
diff --git a/src/backend/storage/page/bufpage.c b/src/backend/storage/page/bufpage.c
index 90a731cc3ae..7bcee9b2d18 100644
--- a/src/backend/storage/page/bufpage.c
+++ b/src/backend/storage/page/bufpage.c
@@ -14,7 +14,7 @@
*/
#include "postgres.h"
-#include "access/htup.h"
+#include "access/htup_details.h"
/* ----------------------------------------------------------------
diff --git a/src/backend/tcop/fastpath.c b/src/backend/tcop/fastpath.c
index 5c0620689e3..48a50630a15 100644
--- a/src/backend/tcop/fastpath.c
+++ b/src/backend/tcop/fastpath.c
@@ -20,6 +20,7 @@
#include <netinet/in.h>
#include <arpa/inet.h>
+#include "access/htup_details.h"
#include "access/xact.h"
#include "catalog/pg_proc.h"
#include "libpq/libpq.h"
diff --git a/src/backend/tcop/utility.c b/src/backend/tcop/utility.c
index ce50560dd6b..ce8a8b1c164 100644
--- a/src/backend/tcop/utility.c
+++ b/src/backend/tcop/utility.c
@@ -16,6 +16,7 @@
*/
#include "postgres.h"
+#include "access/htup_details.h"
#include "access/reloptions.h"
#include "access/twophase.h"
#include "access/xact.h"
diff --git a/src/backend/tsearch/ts_selfuncs.c b/src/backend/tsearch/ts_selfuncs.c
index a07d4100054..8d47bbceb38 100644
--- a/src/backend/tsearch/ts_selfuncs.c
+++ b/src/backend/tsearch/ts_selfuncs.c
@@ -13,6 +13,7 @@
*/
#include "postgres.h"
+#include "access/htup_details.h"
#include "catalog/pg_statistic.h"
#include "catalog/pg_type.h"
#include "miscadmin.h"
diff --git a/src/backend/utils/adt/acl.c b/src/backend/utils/adt/acl.c
index d5903b1f043..fc8e287203c 100644
--- a/src/backend/utils/adt/acl.c
+++ b/src/backend/utils/adt/acl.c
@@ -16,6 +16,7 @@
#include <ctype.h>
+#include "access/htup_details.h"
#include "catalog/namespace.h"
#include "catalog/pg_authid.h"
#include "catalog/pg_auth_members.h"
diff --git a/src/backend/utils/adt/array_selfuncs.c b/src/backend/utils/adt/array_selfuncs.c
index 1b7d46f8586..622d6d13cee 100644
--- a/src/backend/utils/adt/array_selfuncs.c
+++ b/src/backend/utils/adt/array_selfuncs.c
@@ -16,6 +16,7 @@
#include <math.h>
+#include "access/htup_details.h"
#include "catalog/pg_collation.h"
#include "catalog/pg_operator.h"
#include "catalog/pg_statistic.h"
diff --git a/src/backend/utils/adt/arrayfuncs.c b/src/backend/utils/adt/arrayfuncs.c
index e14906fd98d..a4b63951923 100644
--- a/src/backend/utils/adt/arrayfuncs.c
+++ b/src/backend/utils/adt/arrayfuncs.c
@@ -16,6 +16,7 @@
#include <ctype.h>
+#include "access/htup_details.h"
#include "funcapi.h"
#include "libpq/pqformat.h"
#include "utils/array.h"
diff --git a/src/backend/utils/adt/datetime.c b/src/backend/utils/adt/datetime.c
index c29b8e10191..d827d7d1463 100644
--- a/src/backend/utils/adt/datetime.c
+++ b/src/backend/utils/adt/datetime.c
@@ -19,6 +19,7 @@
#include <limits.h>
#include <math.h>
+#include "access/htup_details.h"
#include "access/xact.h"
#include "catalog/pg_type.h"
#include "funcapi.h"
diff --git a/src/backend/utils/adt/dbsize.c b/src/backend/utils/adt/dbsize.c
index 2ccdc0cee6e..cd23334a1a5 100644
--- a/src/backend/utils/adt/dbsize.c
+++ b/src/backend/utils/adt/dbsize.c
@@ -15,6 +15,7 @@
#include <sys/stat.h>
#include "access/heapam.h"
+#include "access/htup_details.h"
#include "catalog/catalog.h"
#include "catalog/namespace.h"
#include "catalog/pg_tablespace.h"
diff --git a/src/backend/utils/adt/enum.c b/src/backend/utils/adt/enum.c
index de46f4c55fb..9388f7848ec 100644
--- a/src/backend/utils/adt/enum.c
+++ b/src/backend/utils/adt/enum.c
@@ -15,6 +15,7 @@
#include "access/genam.h"
#include "access/heapam.h"
+#include "access/htup_details.h"
#include "catalog/indexing.h"
#include "catalog/pg_enum.h"
#include "libpq/pqformat.h"
diff --git a/src/backend/utils/adt/format_type.c b/src/backend/utils/adt/format_type.c
index 952f0a01c14..4e757166b53 100644
--- a/src/backend/utils/adt/format_type.c
+++ b/src/backend/utils/adt/format_type.c
@@ -17,6 +17,7 @@
#include <ctype.h>
+#include "access/htup_details.h"
#include "catalog/namespace.h"
#include "catalog/pg_type.h"
#include "utils/builtins.h"
diff --git a/src/backend/utils/adt/genfile.c b/src/backend/utils/adt/genfile.c
index e50ff6393fc..4450676802b 100644
--- a/src/backend/utils/adt/genfile.c
+++ b/src/backend/utils/adt/genfile.c
@@ -20,6 +20,7 @@
#include <unistd.h>
#include <dirent.h>
+#include "access/htup_details.h"
#include "catalog/pg_type.h"
#include "funcapi.h"
#include "mb/pg_wchar.h"
diff --git a/src/backend/utils/adt/json.c b/src/backend/utils/adt/json.c
index 0425ac6242f..c700da42218 100644
--- a/src/backend/utils/adt/json.c
+++ b/src/backend/utils/adt/json.c
@@ -13,6 +13,7 @@
*/
#include "postgres.h"
+#include "access/htup_details.h"
#include "catalog/pg_type.h"
#include "executor/spi.h"
#include "lib/stringinfo.h"
diff --git a/src/backend/utils/adt/lockfuncs.c b/src/backend/utils/adt/lockfuncs.c
index 33c5b64f50a..dfa37a9576a 100644
--- a/src/backend/utils/adt/lockfuncs.c
+++ b/src/backend/utils/adt/lockfuncs.c
@@ -12,6 +12,7 @@
*/
#include "postgres.h"
+#include "access/htup_details.h"
#include "catalog/pg_type.h"
#include "funcapi.h"
#include "miscadmin.h"
diff --git a/src/backend/utils/adt/pg_locale.c b/src/backend/utils/adt/pg_locale.c
index de881bf6344..92ea4413cc3 100644
--- a/src/backend/utils/adt/pg_locale.c
+++ b/src/backend/utils/adt/pg_locale.c
@@ -54,6 +54,7 @@
#include <locale.h>
#include <time.h>
+#include "access/htup_details.h"
#include "catalog/pg_collation.h"
#include "catalog/pg_control.h"
#include "mb/pg_wchar.h"
diff --git a/src/backend/utils/adt/pgstatfuncs.c b/src/backend/utils/adt/pgstatfuncs.c
index 7c0705abcc9..7d4059f1cbb 100644
--- a/src/backend/utils/adt/pgstatfuncs.c
+++ b/src/backend/utils/adt/pgstatfuncs.c
@@ -14,6 +14,7 @@
*/
#include "postgres.h"
+#include "access/htup_details.h"
#include "catalog/pg_type.h"
#include "funcapi.h"
#include "libpq/ip.h"
diff --git a/src/backend/utils/adt/rangetypes_selfuncs.c b/src/backend/utils/adt/rangetypes_selfuncs.c
index ab2c6d69644..7e20940ae72 100644
--- a/src/backend/utils/adt/rangetypes_selfuncs.c
+++ b/src/backend/utils/adt/rangetypes_selfuncs.c
@@ -17,6 +17,7 @@
*/
#include "postgres.h"
+#include "access/htup_details.h"
#include "catalog/pg_operator.h"
#include "catalog/pg_statistic.h"
#include "utils/lsyscache.h"
diff --git a/src/backend/utils/adt/regproc.c b/src/backend/utils/adt/regproc.c
index 11b3f571935..a15f670f146 100644
--- a/src/backend/utils/adt/regproc.c
+++ b/src/backend/utils/adt/regproc.c
@@ -23,6 +23,7 @@
#include "access/genam.h"
#include "access/heapam.h"
+#include "access/htup_details.h"
#include "catalog/indexing.h"
#include "catalog/namespace.h"
#include "catalog/pg_class.h"
diff --git a/src/backend/utils/adt/ri_triggers.c b/src/backend/utils/adt/ri_triggers.c
index 983f631234b..97e68b1b6cb 100644
--- a/src/backend/utils/adt/ri_triggers.c
+++ b/src/backend/utils/adt/ri_triggers.c
@@ -30,8 +30,9 @@
#include "postgres.h"
-#include "access/xact.h"
+#include "access/htup_details.h"
#include "access/sysattr.h"
+#include "access/xact.h"
#include "catalog/pg_collation.h"
#include "catalog/pg_constraint.h"
#include "catalog/pg_operator.h"
diff --git a/src/backend/utils/adt/rowtypes.c b/src/backend/utils/adt/rowtypes.c
index ba7fde43132..13e574d4e82 100644
--- a/src/backend/utils/adt/rowtypes.c
+++ b/src/backend/utils/adt/rowtypes.c
@@ -16,6 +16,7 @@
#include <ctype.h>
+#include "access/htup_details.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 ae6278432fd..08396431384 100644
--- a/src/backend/utils/adt/ruleutils.c
+++ b/src/backend/utils/adt/ruleutils.c
@@ -18,6 +18,7 @@
#include <unistd.h>
#include <fcntl.h>
+#include "access/htup_details.h"
#include "access/sysattr.h"
#include "catalog/dependency.h"
#include "catalog/indexing.h"
diff --git a/src/backend/utils/adt/selfuncs.c b/src/backend/utils/adt/selfuncs.c
index 40e1bebac16..2ab26dea290 100644
--- a/src/backend/utils/adt/selfuncs.c
+++ b/src/backend/utils/adt/selfuncs.c
@@ -101,6 +101,7 @@
#include <math.h>
#include "access/gin.h"
+#include "access/htup_details.h"
#include "access/sysattr.h"
#include "catalog/index.h"
#include "catalog/pg_collation.h"
diff --git a/src/backend/utils/adt/trigfuncs.c b/src/backend/utils/adt/trigfuncs.c
index a7e3ae9b0f4..81c799d94fb 100644
--- a/src/backend/utils/adt/trigfuncs.c
+++ b/src/backend/utils/adt/trigfuncs.c
@@ -13,6 +13,7 @@
*/
#include "postgres.h"
+#include "access/htup_details.h"
#include "commands/trigger.h"
#include "utils/builtins.h"
#include "utils/rel.h"
diff --git a/src/backend/utils/adt/varbit.c b/src/backend/utils/adt/varbit.c
index 2bcf5b8aa8c..2378d27324d 100644
--- a/src/backend/utils/adt/varbit.c
+++ b/src/backend/utils/adt/varbit.c
@@ -16,7 +16,7 @@
#include "postgres.h"
-#include "access/htup.h"
+#include "access/htup_details.h"
#include "libpq/pqformat.h"
#include "nodes/nodeFuncs.h"
#include "utils/array.h"
diff --git a/src/backend/utils/adt/xml.c b/src/backend/utils/adt/xml.c
index 2d945b9cdba..051d4036816 100644
--- a/src/backend/utils/adt/xml.c
+++ b/src/backend/utils/adt/xml.c
@@ -67,6 +67,7 @@
#endif
#endif /* USE_LIBXML */
+#include "access/htup_details.h"
#include "catalog/namespace.h"
#include "catalog/pg_type.h"
#include "commands/dbcommands.h"
diff --git a/src/backend/utils/cache/evtcache.c b/src/backend/utils/cache/evtcache.c
index 6707ea1f822..0dd53110cec 100644
--- a/src/backend/utils/cache/evtcache.c
+++ b/src/backend/utils/cache/evtcache.c
@@ -15,6 +15,7 @@
#include "access/genam.h"
#include "access/heapam.h"
+#include "access/htup_details.h"
#include "catalog/pg_event_trigger.h"
#include "catalog/indexing.h"
#include "catalog/pg_type.h"
diff --git a/src/backend/utils/cache/inval.c b/src/backend/utils/cache/inval.c
index 15b1711109c..e26bf0bce47 100644
--- a/src/backend/utils/cache/inval.c
+++ b/src/backend/utils/cache/inval.c
@@ -95,6 +95,7 @@
*/
#include "postgres.h"
+#include "access/htup_details.h"
#include "access/xact.h"
#include "catalog/catalog.h"
#include "miscadmin.h"
diff --git a/src/backend/utils/cache/lsyscache.c b/src/backend/utils/cache/lsyscache.c
index 0e479e80e1c..b2ae3654035 100644
--- a/src/backend/utils/cache/lsyscache.c
+++ b/src/backend/utils/cache/lsyscache.c
@@ -16,6 +16,7 @@
#include "postgres.h"
#include "access/hash.h"
+#include "access/htup_details.h"
#include "access/nbtree.h"
#include "bootstrap/bootstrap.h"
#include "catalog/pg_amop.h"
diff --git a/src/backend/utils/cache/relcache.c b/src/backend/utils/cache/relcache.c
index 0f26b34bc4d..0cdd30d15b1 100644
--- a/src/backend/utils/cache/relcache.c
+++ b/src/backend/utils/cache/relcache.c
@@ -33,6 +33,7 @@
#include "access/reloptions.h"
#include "access/sysattr.h"
#include "access/transam.h"
+#include "access/htup_details.h"
#include "access/xact.h"
#include "catalog/catalog.h"
#include "catalog/index.h"
diff --git a/src/backend/utils/cache/syscache.c b/src/backend/utils/cache/syscache.c
index 1967895873b..ca22efd7651 100644
--- a/src/backend/utils/cache/syscache.c
+++ b/src/backend/utils/cache/syscache.c
@@ -20,6 +20,7 @@
*/
#include "postgres.h"
+#include "access/htup_details.h"
#include "access/sysattr.h"
#include "catalog/indexing.h"
#include "catalog/pg_aggregate.h"
diff --git a/src/backend/utils/cache/ts_cache.c b/src/backend/utils/cache/ts_cache.c
index b369790bde6..c907c8fe690 100644
--- a/src/backend/utils/cache/ts_cache.c
+++ b/src/backend/utils/cache/ts_cache.c
@@ -28,6 +28,7 @@
#include "access/genam.h"
#include "access/heapam.h"
+#include "access/htup_details.h"
#include "access/xact.h"
#include "catalog/indexing.h"
#include "catalog/namespace.h"
diff --git a/src/backend/utils/cache/typcache.c b/src/backend/utils/cache/typcache.c
index 9af5e868559..e3b8ca907f0 100644
--- a/src/backend/utils/cache/typcache.c
+++ b/src/backend/utils/cache/typcache.c
@@ -47,6 +47,7 @@
#include "access/hash.h"
#include "access/heapam.h"
+#include "access/htup_details.h"
#include "access/nbtree.h"
#include "catalog/indexing.h"
#include "catalog/pg_enum.h"
diff --git a/src/backend/utils/fmgr/funcapi.c b/src/backend/utils/fmgr/funcapi.c
index addf95bca9b..e6cec7f13cb 100644
--- a/src/backend/utils/fmgr/funcapi.c
+++ b/src/backend/utils/fmgr/funcapi.c
@@ -13,6 +13,7 @@
*/
#include "postgres.h"
+#include "access/htup_details.h"
#include "catalog/namespace.h"
#include "catalog/pg_proc.h"
#include "catalog/pg_type.h"
diff --git a/src/backend/utils/init/miscinit.c b/src/backend/utils/init/miscinit.c
index 9a0f92c2682..5288aa77ee1 100644
--- a/src/backend/utils/init/miscinit.c
+++ b/src/backend/utils/init/miscinit.c
@@ -29,6 +29,7 @@
#include <utime.h>
#endif
+#include "access/htup_details.h"
#include "catalog/pg_authid.h"
#include "mb/pg_wchar.h"
#include "miscadmin.h"
diff --git a/src/backend/utils/init/postinit.c b/src/backend/utils/init/postinit.c
index bef301a79c8..757e76bd7af 100644
--- a/src/backend/utils/init/postinit.c
+++ b/src/backend/utils/init/postinit.c
@@ -20,6 +20,7 @@
#include <unistd.h>
#include "access/heapam.h"
+#include "access/htup_details.h"
#include "access/sysattr.h"
#include "access/xact.h"
#include "catalog/catalog.h"
diff --git a/src/backend/utils/misc/superuser.c b/src/backend/utils/misc/superuser.c
index 9accb9d56b0..dc574daed12 100644
--- a/src/backend/utils/misc/superuser.c
+++ b/src/backend/utils/misc/superuser.c
@@ -20,6 +20,7 @@
*/
#include "postgres.h"
+#include "access/htup_details.h"
#include "catalog/pg_authid.h"
#include "utils/inval.h"
#include "utils/syscache.h"
diff --git a/src/backend/utils/sort/tuplesort.c b/src/backend/utils/sort/tuplesort.c
index d5a2003e5b8..ce27e404be9 100644
--- a/src/backend/utils/sort/tuplesort.c
+++ b/src/backend/utils/sort/tuplesort.c
@@ -100,6 +100,7 @@
#include <limits.h>
+#include "access/htup_details.h"
#include "access/nbtree.h"
#include "catalog/index.h"
#include "commands/tablespace.h"
diff --git a/src/backend/utils/sort/tuplestore.c b/src/backend/utils/sort/tuplestore.c
index 8a7931b8566..1b1cf35623e 100644
--- a/src/backend/utils/sort/tuplestore.c
+++ b/src/backend/utils/sort/tuplestore.c
@@ -54,6 +54,7 @@
#include "postgres.h"
+#include "access/htup_details.h"
#include "commands/tablespace.h"
#include "executor/executor.h"
#include "storage/buffile.h"
diff --git a/src/backend/utils/time/combocid.c b/src/backend/utils/time/combocid.c
index 5429922d3f1..f91e7faab52 100644
--- a/src/backend/utils/time/combocid.c
+++ b/src/backend/utils/time/combocid.c
@@ -41,7 +41,7 @@
#include "postgres.h"
-#include "access/htup.h"
+#include "access/htup_details.h"
#include "access/xact.h"
#include "utils/combocid.h"
#include "utils/hsearch.h"
diff --git a/src/backend/utils/time/tqual.c b/src/backend/utils/time/tqual.c
index 4caef9ca25e..b531db5087c 100644
--- a/src/backend/utils/time/tqual.c
+++ b/src/backend/utils/time/tqual.c
@@ -57,6 +57,7 @@
#include "postgres.h"
+#include "access/htup_details.h"
#include "access/multixact.h"
#include "access/subtrans.h"
#include "access/transam.h"
diff --git a/src/include/access/heapam.h b/src/include/access/heapam.h
index 2d73ae8fb88..a4ab0627a0d 100644
--- a/src/include/access/heapam.h
+++ b/src/include/access/heapam.h
@@ -17,6 +17,7 @@
#include "access/sdir.h"
#include "access/skey.h"
#include "nodes/primnodes.h"
+#include "storage/bufpage.h"
#include "storage/lock.h"
#include "utils/relcache.h"
#include "utils/snapshot.h"
diff --git a/src/include/access/heapam_xlog.h b/src/include/access/heapam_xlog.h
index 4ccea5ce4e8..8ec710e85f6 100644
--- a/src/include/access/heapam_xlog.h
+++ b/src/include/access/heapam_xlog.h
@@ -16,6 +16,7 @@
#include "access/htup.h"
#include "access/xlog.h"
+#include "storage/bufpage.h"
#include "storage/relfilenode.h"
#include "utils/relcache.h"
diff --git a/src/include/access/htup.h b/src/include/access/htup.h
index 74cad2bb2b3..53b711046c0 100644
--- a/src/include/access/htup.h
+++ b/src/include/access/htup.h
@@ -14,470 +14,15 @@
#ifndef HTUP_H
#define HTUP_H
-#include "access/tupdesc.h"
-#include "access/tupmacs.h"
-#include "storage/bufpage.h"
#include "storage/itemptr.h"
-#include "storage/relfilenode.h"
-/*
- * MaxTupleAttributeNumber limits the number of (user) columns in a tuple.
- * The key limit on this value is that the size of the fixed overhead for
- * a tuple, plus the size of the null-values bitmap (at 1 bit per column),
- * plus MAXALIGN alignment, must fit into t_hoff which is uint8. On most
- * machines the upper limit without making t_hoff wider would be a little
- * over 1700. We use round numbers here and for MaxHeapAttributeNumber
- * so that alterations in HeapTupleHeaderData layout won't change the
- * supported max number of columns.
- */
-#define MaxTupleAttributeNumber 1664 /* 8 * 208 */
-
-/*
- * MaxHeapAttributeNumber limits the number of (user) columns in a table.
- * This should be somewhat less than MaxTupleAttributeNumber. It must be
- * at least one less, else we will fail to do UPDATEs on a maximal-width
- * table (because UPDATE has to form working tuples that include CTID).
- * In practice we want some additional daylight so that we can gracefully
- * support operations that add hidden "resjunk" columns, for example
- * SELECT * FROM wide_table ORDER BY foo, bar, baz.
- * In any case, depending on column data types you will likely be running
- * into the disk-block-based limit on overall tuple size if you have more
- * than a thousand or so columns. TOAST won't help.
- */
-#define MaxHeapAttributeNumber 1600 /* 8 * 200 */
-
-/*
- * Heap tuple header. To avoid wasting space, the fields should be
- * laid out in such a way as to avoid structure padding.
- *
- * Datums of composite types (row types) share the same general structure
- * as on-disk tuples, so that the same routines can be used to build and
- * examine them. However the requirements are slightly different: a Datum
- * does not need any transaction visibility information, and it does need
- * a length word and some embedded type information. We can achieve this
- * by overlaying the xmin/cmin/xmax/cmax/xvac fields of a heap tuple
- * with the fields needed in the Datum case. Typically, all tuples built
- * in-memory will be initialized with the Datum fields; but when a tuple is
- * about to be inserted in a table, the transaction fields will be filled,
- * overwriting the datum fields.
- *
- * The overall structure of a heap tuple looks like:
- * fixed fields (HeapTupleHeaderData struct)
- * nulls bitmap (if HEAP_HASNULL is set in t_infomask)
- * alignment padding (as needed to make user data MAXALIGN'd)
- * object ID (if HEAP_HASOID is set in t_infomask)
- * user data fields
- *
- * We store five "virtual" fields Xmin, Cmin, Xmax, Cmax, and Xvac in three
- * physical fields. Xmin and Xmax are always really stored, but Cmin, Cmax
- * and Xvac share a field. This works because we know that Cmin and Cmax
- * are only interesting for the lifetime of the inserting and deleting
- * transaction respectively. If a tuple is inserted and deleted in the same
- * transaction, we store a "combo" command id that can be mapped to the real
- * cmin and cmax, but only by use of local state within the originating
- * backend. See combocid.c for more details. Meanwhile, Xvac is only set by
- * old-style VACUUM FULL, which does not have any command sub-structure and so
- * does not need either Cmin or Cmax. (This requires that old-style VACUUM
- * FULL never try to move a tuple whose Cmin or Cmax is still interesting,
- * ie, an insert-in-progress or delete-in-progress tuple.)
- *
- * A word about t_ctid: whenever a new tuple is stored on disk, its t_ctid
- * is initialized with its own TID (location). If the tuple is ever updated,
- * its t_ctid is changed to point to the replacement version of the tuple.
- * Thus, a tuple is the latest version of its row iff XMAX is invalid or
- * t_ctid points to itself (in which case, if XMAX is valid, the tuple is
- * either locked or deleted). One can follow the chain of t_ctid links
- * to find the newest version of the row. Beware however that VACUUM might
- * erase the pointed-to (newer) tuple before erasing the pointing (older)
- * tuple. Hence, when following a t_ctid link, it is necessary to check
- * to see if the referenced slot is empty or contains an unrelated tuple.
- * Check that the referenced tuple has XMIN equal to the referencing tuple's
- * XMAX to verify that it is actually the descendant version and not an
- * unrelated tuple stored into a slot recently freed by VACUUM. If either
- * check fails, one may assume that there is no live descendant version.
- *
- * Following the fixed header fields, the nulls bitmap is stored (beginning
- * at t_bits). The bitmap is *not* stored if t_infomask shows that there
- * are no nulls in the tuple. If an OID field is present (as indicated by
- * t_infomask), then it is stored just before the user data, which begins at
- * the offset shown by t_hoff. Note that t_hoff must be a multiple of
- * MAXALIGN.
- */
-
-typedef struct HeapTupleFields
-{
- TransactionId t_xmin; /* inserting xact ID */
- TransactionId t_xmax; /* deleting or locking xact ID */
-
- union
- {
- CommandId t_cid; /* inserting or deleting command ID, or both */
- TransactionId t_xvac; /* old-style VACUUM FULL xact ID */
- } t_field3;
-} HeapTupleFields;
-
-typedef struct DatumTupleFields
-{
- int32 datum_len_; /* varlena header (do not touch directly!) */
+/* typedefs and forward declarations for structs defined in htup.h */
- int32 datum_typmod; /* -1, or identifier of a record type */
-
- Oid datum_typeid; /* composite type OID, or RECORDOID */
-
- /*
- * Note: field ordering is chosen with thought that Oid might someday
- * widen to 64 bits.
- */
-} DatumTupleFields;
-
-typedef struct HeapTupleHeaderData
-{
- union
- {
- HeapTupleFields t_heap;
- DatumTupleFields t_datum;
- } t_choice;
-
- ItemPointerData t_ctid; /* current TID of this or newer tuple */
-
- /* Fields below here must match MinimalTupleData! */
-
- uint16 t_infomask2; /* number of attributes + various flags */
-
- uint16 t_infomask; /* various flag bits, see below */
-
- uint8 t_hoff; /* sizeof header incl. bitmap, padding */
-
- /* ^ - 23 bytes - ^ */
-
- bits8 t_bits[1]; /* bitmap of NULLs -- VARIABLE LENGTH */
-
- /* MORE DATA FOLLOWS AT END OF STRUCT */
-} HeapTupleHeaderData;
+typedef struct HeapTupleHeaderData HeapTupleHeaderData;
typedef HeapTupleHeaderData *HeapTupleHeader;
-/*
- * information stored in t_infomask:
- */
-#define HEAP_HASNULL 0x0001 /* has null attribute(s) */
-#define HEAP_HASVARWIDTH 0x0002 /* has variable-width attribute(s) */
-#define HEAP_HASEXTERNAL 0x0004 /* has external stored attribute(s) */
-#define HEAP_HASOID 0x0008 /* has an object-id field */
-/* bit 0x0010 is available */
-#define HEAP_COMBOCID 0x0020 /* t_cid is a combo cid */
-#define HEAP_XMAX_EXCL_LOCK 0x0040 /* xmax is exclusive locker */
-#define HEAP_XMAX_SHARED_LOCK 0x0080 /* xmax is shared locker */
-/* if either LOCK bit is set, xmax hasn't deleted the tuple, only locked it */
-#define HEAP_IS_LOCKED (HEAP_XMAX_EXCL_LOCK | HEAP_XMAX_SHARED_LOCK)
-#define HEAP_XMIN_COMMITTED 0x0100 /* t_xmin committed */
-#define HEAP_XMIN_INVALID 0x0200 /* t_xmin invalid/aborted */
-#define HEAP_XMAX_COMMITTED 0x0400 /* t_xmax committed */
-#define HEAP_XMAX_INVALID 0x0800 /* t_xmax invalid/aborted */
-#define HEAP_XMAX_IS_MULTI 0x1000 /* t_xmax is a MultiXactId */
-#define HEAP_UPDATED 0x2000 /* this is UPDATEd version of row */
-#define HEAP_MOVED_OFF 0x4000 /* moved to another place by pre-9.0
- * VACUUM FULL; kept for binary
- * upgrade support */
-#define HEAP_MOVED_IN 0x8000 /* moved from another place by pre-9.0
- * VACUUM FULL; kept for binary
- * upgrade support */
-#define HEAP_MOVED (HEAP_MOVED_OFF | HEAP_MOVED_IN)
-
-#define HEAP_XACT_MASK 0xFFE0 /* visibility-related bits */
-
-/*
- * information stored in t_infomask2:
- */
-#define HEAP_NATTS_MASK 0x07FF /* 11 bits for number of attributes */
-/* bits 0x3800 are available */
-#define HEAP_HOT_UPDATED 0x4000 /* tuple was HOT-updated */
-#define HEAP_ONLY_TUPLE 0x8000 /* this is heap-only tuple */
-
-#define HEAP2_XACT_MASK 0xC000 /* visibility-related bits */
-
-/*
- * HEAP_TUPLE_HAS_MATCH is a temporary flag used during hash joins. It is
- * only used in tuples that are in the hash table, and those don't need
- * any visibility information, so we can overlay it on a visibility flag
- * instead of using up a dedicated bit.
- */
-#define HEAP_TUPLE_HAS_MATCH HEAP_ONLY_TUPLE /* tuple has a join match */
-
-/*
- * HeapTupleHeader accessor macros
- *
- * Note: beware of multiple evaluations of "tup" argument. But the Set
- * macros evaluate their other argument only once.
- */
-
-#define HeapTupleHeaderGetXmin(tup) \
-( \
- (tup)->t_choice.t_heap.t_xmin \
-)
-
-#define HeapTupleHeaderSetXmin(tup, xid) \
-( \
- (tup)->t_choice.t_heap.t_xmin = (xid) \
-)
-
-#define HeapTupleHeaderGetXmax(tup) \
-( \
- (tup)->t_choice.t_heap.t_xmax \
-)
-
-#define HeapTupleHeaderSetXmax(tup, xid) \
-( \
- (tup)->t_choice.t_heap.t_xmax = (xid) \
-)
-
-/*
- * HeapTupleHeaderGetRawCommandId will give you what's in the header whether
- * it is useful or not. Most code should use HeapTupleHeaderGetCmin or
- * HeapTupleHeaderGetCmax instead, but note that those Assert that you can
- * get a legitimate result, ie you are in the originating transaction!
- */
-#define HeapTupleHeaderGetRawCommandId(tup) \
-( \
- (tup)->t_choice.t_heap.t_field3.t_cid \
-)
-
-/* SetCmin is reasonably simple since we never need a combo CID */
-#define HeapTupleHeaderSetCmin(tup, cid) \
-do { \
- Assert(!((tup)->t_infomask & HEAP_MOVED)); \
- (tup)->t_choice.t_heap.t_field3.t_cid = (cid); \
- (tup)->t_infomask &= ~HEAP_COMBOCID; \
-} while (0)
-
-/* SetCmax must be used after HeapTupleHeaderAdjustCmax; see combocid.c */
-#define HeapTupleHeaderSetCmax(tup, cid, iscombo) \
-do { \
- Assert(!((tup)->t_infomask & HEAP_MOVED)); \
- (tup)->t_choice.t_heap.t_field3.t_cid = (cid); \
- if (iscombo) \
- (tup)->t_infomask |= HEAP_COMBOCID; \
- else \
- (tup)->t_infomask &= ~HEAP_COMBOCID; \
-} while (0)
-
-#define HeapTupleHeaderGetXvac(tup) \
-( \
- ((tup)->t_infomask & HEAP_MOVED) ? \
- (tup)->t_choice.t_heap.t_field3.t_xvac \
- : \
- InvalidTransactionId \
-)
-
-#define HeapTupleHeaderSetXvac(tup, xid) \
-do { \
- Assert((tup)->t_infomask & HEAP_MOVED); \
- (tup)->t_choice.t_heap.t_field3.t_xvac = (xid); \
-} while (0)
-
-#define HeapTupleHeaderGetDatumLength(tup) \
- VARSIZE(tup)
-
-#define HeapTupleHeaderSetDatumLength(tup, len) \
- SET_VARSIZE(tup, len)
-
-#define HeapTupleHeaderGetTypeId(tup) \
-( \
- (tup)->t_choice.t_datum.datum_typeid \
-)
-
-#define HeapTupleHeaderSetTypeId(tup, typeid) \
-( \
- (tup)->t_choice.t_datum.datum_typeid = (typeid) \
-)
-
-#define HeapTupleHeaderGetTypMod(tup) \
-( \
- (tup)->t_choice.t_datum.datum_typmod \
-)
-
-#define HeapTupleHeaderSetTypMod(tup, typmod) \
-( \
- (tup)->t_choice.t_datum.datum_typmod = (typmod) \
-)
-
-#define HeapTupleHeaderGetOid(tup) \
-( \
- ((tup)->t_infomask & HEAP_HASOID) ? \
- *((Oid *) ((char *)(tup) + (tup)->t_hoff - sizeof(Oid))) \
- : \
- InvalidOid \
-)
-
-#define HeapTupleHeaderSetOid(tup, oid) \
-do { \
- Assert((tup)->t_infomask & HEAP_HASOID); \
- *((Oid *) ((char *)(tup) + (tup)->t_hoff - sizeof(Oid))) = (oid); \
-} while (0)
-
-/*
- * Note that we stop considering a tuple HOT-updated as soon as it is known
- * aborted or the would-be updating transaction is known aborted. For best
- * efficiency, check tuple visibility before using this macro, so that the
- * INVALID bits will be as up to date as possible.
- */
-#define HeapTupleHeaderIsHotUpdated(tup) \
-( \
- ((tup)->t_infomask2 & HEAP_HOT_UPDATED) != 0 && \
- ((tup)->t_infomask & (HEAP_XMIN_INVALID | HEAP_XMAX_INVALID)) == 0 \
-)
-
-#define HeapTupleHeaderSetHotUpdated(tup) \
-( \
- (tup)->t_infomask2 |= HEAP_HOT_UPDATED \
-)
-
-#define HeapTupleHeaderClearHotUpdated(tup) \
-( \
- (tup)->t_infomask2 &= ~HEAP_HOT_UPDATED \
-)
-
-#define HeapTupleHeaderIsHeapOnly(tup) \
-( \
- (tup)->t_infomask2 & HEAP_ONLY_TUPLE \
-)
-
-#define HeapTupleHeaderSetHeapOnly(tup) \
-( \
- (tup)->t_infomask2 |= HEAP_ONLY_TUPLE \
-)
-
-#define HeapTupleHeaderClearHeapOnly(tup) \
-( \
- (tup)->t_infomask2 &= ~HEAP_ONLY_TUPLE \
-)
-
-#define HeapTupleHeaderHasMatch(tup) \
-( \
- (tup)->t_infomask2 & HEAP_TUPLE_HAS_MATCH \
-)
-
-#define HeapTupleHeaderSetMatch(tup) \
-( \
- (tup)->t_infomask2 |= HEAP_TUPLE_HAS_MATCH \
-)
-
-#define HeapTupleHeaderClearMatch(tup) \
-( \
- (tup)->t_infomask2 &= ~HEAP_TUPLE_HAS_MATCH \
-)
-
-#define HeapTupleHeaderGetNatts(tup) \
- ((tup)->t_infomask2 & HEAP_NATTS_MASK)
-
-#define HeapTupleHeaderSetNatts(tup, natts) \
-( \
- (tup)->t_infomask2 = ((tup)->t_infomask2 & ~HEAP_NATTS_MASK) | (natts) \
-)
-
-
-/*
- * BITMAPLEN(NATTS) -
- * Computes size of null bitmap given number of data columns.
- */
-#define BITMAPLEN(NATTS) (((int)(NATTS) + 7) / 8)
-
-/*
- * MaxHeapTupleSize is the maximum allowed size of a heap tuple, including
- * header and MAXALIGN alignment padding. Basically it's BLCKSZ minus the
- * other stuff that has to be on a disk page. Since heap pages use no
- * "special space", there's no deduction for that.
- *
- * NOTE: we allow for the ItemId that must point to the tuple, ensuring that
- * an otherwise-empty page can indeed hold a tuple of this size. Because
- * ItemIds and tuples have different alignment requirements, don't assume that
- * you can, say, fit 2 tuples of size MaxHeapTupleSize/2 on the same page.
- */
-#define MaxHeapTupleSize (BLCKSZ - MAXALIGN(SizeOfPageHeaderData + sizeof(ItemIdData)))
-
-/*
- * MaxHeapTuplesPerPage is an upper bound on the number of tuples that can
- * fit on one heap page. (Note that indexes could have more, because they
- * use a smaller tuple header.) We arrive at the divisor because each tuple
- * must be maxaligned, and it must have an associated item pointer.
- *
- * Note: with HOT, there could theoretically be more line pointers (not actual
- * tuples) than this on a heap page. However we constrain the number of line
- * pointers to this anyway, to avoid excessive line-pointer bloat and not
- * require increases in the size of work arrays.
- */
-#define MaxHeapTuplesPerPage \
- ((int) ((BLCKSZ - SizeOfPageHeaderData) / \
- (MAXALIGN(offsetof(HeapTupleHeaderData, t_bits)) + sizeof(ItemIdData))))
-
-/*
- * MaxAttrSize is a somewhat arbitrary upper limit on the declared size of
- * data fields of char(n) and similar types. It need not have anything
- * directly to do with the *actual* upper limit of varlena values, which
- * is currently 1Gb (see TOAST structures in postgres.h). I've set it
- * at 10Mb which seems like a reasonable number --- tgl 8/6/00.
- */
-#define MaxAttrSize (10 * 1024 * 1024)
-
-
-/*
- * 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
- * is worthwhile because we need to store many tuples. The representation
- * is chosen so that tuple access routines can work with either full or
- * minimal tuples via a HeapTupleData pointer structure. The access routines
- * see no difference, except that they must not access the transaction status
- * or t_ctid fields because those aren't there.
- *
- * For the most part, MinimalTuples should be accessed via TupleTableSlot
- * routines. These routines will prevent access to the "system columns"
- * and thereby prevent accidental use of the nonexistent fields.
- *
- * MinimalTupleData contains a length word, some padding, and fields matching
- * HeapTupleHeaderData beginning with t_infomask2. The padding is chosen so
- * that offsetof(t_infomask2) is the same modulo MAXIMUM_ALIGNOF in both
- * structs. This makes data alignment rules equivalent in both cases.
- *
- * When a minimal tuple is accessed via a HeapTupleData pointer, t_data is
- * set to point MINIMAL_TUPLE_OFFSET bytes before the actual start of the
- * minimal tuple --- that is, where a full tuple matching the minimal tuple's
- * data would start. This trick is what makes the structs seem equivalent.
- *
- * Note that t_hoff is computed the same as in a full tuple, hence it includes
- * the MINIMAL_TUPLE_OFFSET distance. t_len does not include that, however.
- *
- * MINIMAL_TUPLE_DATA_OFFSET is the offset to the first useful (non-pad) data
- * other than the length word. tuplesort.c and tuplestore.c use this to avoid
- * writing the padding to disk.
- */
-#define MINIMAL_TUPLE_OFFSET \
- ((offsetof(HeapTupleHeaderData, t_infomask2) - sizeof(uint32)) / MAXIMUM_ALIGNOF * MAXIMUM_ALIGNOF)
-#define MINIMAL_TUPLE_PADDING \
- ((offsetof(HeapTupleHeaderData, t_infomask2) - sizeof(uint32)) % MAXIMUM_ALIGNOF)
-#define MINIMAL_TUPLE_DATA_OFFSET \
- offsetof(MinimalTupleData, t_infomask2)
-
-typedef struct MinimalTupleData
-{
- uint32 t_len; /* actual length of minimal tuple */
-
- char mt_padding[MINIMAL_TUPLE_PADDING];
-
- /* Fields below here must match HeapTupleHeaderData! */
-
- uint16 t_infomask2; /* number of attributes + various flags */
-
- uint16 t_infomask; /* various flag bits, see below */
-
- uint8 t_hoff; /* sizeof header incl. bitmap, padding */
-
- /* ^ - 23 bytes - ^ */
-
- bits8 t_bits[1]; /* bitmap of NULLs -- VARIABLE LENGTH */
-
- /* MORE DATA FOLLOWS AT END OF STRUCT */
-} MinimalTupleData;
+typedef struct MinimalTupleData MinimalTupleData;
typedef MinimalTupleData *MinimalTuple;
@@ -527,56 +72,10 @@ typedef HeapTupleData *HeapTuple;
#define HEAPTUPLESIZE MAXALIGN(sizeof(HeapTupleData))
/*
- * GETSTRUCT - given a HeapTuple pointer, return address of the user data
- */
-#define GETSTRUCT(TUP) ((char *) ((TUP)->t_data) + (TUP)->t_data->t_hoff)
-
-/*
* Accessor macros to be used with HeapTuple pointers.
*/
#define HeapTupleIsValid(tuple) PointerIsValid(tuple)
-#define HeapTupleHasNulls(tuple) \
- (((tuple)->t_data->t_infomask & HEAP_HASNULL) != 0)
-
-#define HeapTupleNoNulls(tuple) \
- (!((tuple)->t_data->t_infomask & HEAP_HASNULL))
-
-#define HeapTupleHasVarWidth(tuple) \
- (((tuple)->t_data->t_infomask & HEAP_HASVARWIDTH) != 0)
-
-#define HeapTupleAllFixed(tuple) \
- (!((tuple)->t_data->t_infomask & HEAP_HASVARWIDTH))
-
-#define HeapTupleHasExternal(tuple) \
- (((tuple)->t_data->t_infomask & HEAP_HASEXTERNAL) != 0)
-
-#define HeapTupleIsHotUpdated(tuple) \
- HeapTupleHeaderIsHotUpdated((tuple)->t_data)
-
-#define HeapTupleSetHotUpdated(tuple) \
- HeapTupleHeaderSetHotUpdated((tuple)->t_data)
-
-#define HeapTupleClearHotUpdated(tuple) \
- HeapTupleHeaderClearHotUpdated((tuple)->t_data)
-
-#define HeapTupleIsHeapOnly(tuple) \
- HeapTupleHeaderIsHeapOnly((tuple)->t_data)
-
-#define HeapTupleSetHeapOnly(tuple) \
- HeapTupleHeaderSetHeapOnly((tuple)->t_data)
-
-#define HeapTupleClearHeapOnly(tuple) \
- HeapTupleHeaderClearHeapOnly((tuple)->t_data)
-
-#define HeapTupleGetOid(tuple) \
- HeapTupleHeaderGetOid((tuple)->t_data)
-
-#define HeapTupleSetOid(tuple, oid) \
- HeapTupleHeaderSetOid((tuple)->t_data, (oid))
-
-
-
/* HeapTupleHeader functions implemented in utils/time/combocid.c */
extern CommandId HeapTupleHeaderGetCmin(HeapTupleHeader tup);
extern CommandId HeapTupleHeaderGetCmax(HeapTupleHeader tup);
@@ -584,129 +83,4 @@ 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) = false), \
- 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)) \
- ) \
- : \
- ( \
- att_isnull((attnum)-1, (tup)->t_data->t_bits) ? \
- ( \
- (*(isnull) = true), \
- (Datum)NULL \
- ) \
- : \
- ( \
- nocachegetattr((tup), (attnum), (tupleDesc)) \
- ) \
- ) \
-)
-#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) \
- ( \
- ((attnum) > 0) ? \
- ( \
- ((attnum) > (int) HeapTupleHeaderGetNatts((tup)->t_data)) ? \
- ( \
- (*(isnull) = true), \
- (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);
-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_modify_tuple(HeapTuple tuple,
- TupleDesc tupleDesc,
- Datum *replValues,
- bool *replIsnull,
- bool *doReplace);
-extern void heap_deform_tuple(HeapTuple tuple, TupleDesc tupleDesc,
- Datum *values, bool *isnull);
-
-/* these three are deprecated versions of the three above: */
-extern HeapTuple heap_formtuple(TupleDesc tupleDescriptor,
- Datum *values, char *nulls);
-extern HeapTuple heap_modifytuple(HeapTuple tuple,
- TupleDesc tupleDesc,
- Datum *replValues,
- char *replNulls,
- char *replActions);
-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);
-
#endif /* HTUP_H */
diff --git a/src/include/access/htup_details.h b/src/include/access/htup_details.h
new file mode 100644
index 00000000000..7abe3e655d7
--- /dev/null
+++ b/src/include/access/htup_details.h
@@ -0,0 +1,657 @@
+/*-------------------------------------------------------------------------
+ *
+ * htup_details.h
+ * POSTGRES heap tuple header definitions.
+ *
+ *
+ * Portions Copyright (c) 1996-2012, PostgreSQL Global Development Group
+ * Portions Copyright (c) 1994, Regents of the University of California
+ *
+ * src/include/access/htup_details.h
+ *
+ *-------------------------------------------------------------------------
+ */
+#ifndef HTUP_DETAILS_H
+#define HTUP_DETAILS_H
+
+#include "access/htup.h"
+#include "access/tupdesc.h"
+#include "access/tupmacs.h"
+#include "storage/bufpage.h"
+
+/*
+ * MaxTupleAttributeNumber limits the number of (user) columns in a tuple.
+ * The key limit on this value is that the size of the fixed overhead for
+ * a tuple, plus the size of the null-values bitmap (at 1 bit per column),
+ * plus MAXALIGN alignment, must fit into t_hoff which is uint8. On most
+ * machines the upper limit without making t_hoff wider would be a little
+ * over 1700. We use round numbers here and for MaxHeapAttributeNumber
+ * so that alterations in HeapTupleHeaderData layout won't change the
+ * supported max number of columns.
+ */
+#define MaxTupleAttributeNumber 1664 /* 8 * 208 */
+
+/*
+ * MaxHeapAttributeNumber limits the number of (user) columns in a table.
+ * This should be somewhat less than MaxTupleAttributeNumber. It must be
+ * at least one less, else we will fail to do UPDATEs on a maximal-width
+ * table (because UPDATE has to form working tuples that include CTID).
+ * In practice we want some additional daylight so that we can gracefully
+ * support operations that add hidden "resjunk" columns, for example
+ * SELECT * FROM wide_table ORDER BY foo, bar, baz.
+ * In any case, depending on column data types you will likely be running
+ * into the disk-block-based limit on overall tuple size if you have more
+ * than a thousand or so columns. TOAST won't help.
+ */
+#define MaxHeapAttributeNumber 1600 /* 8 * 200 */
+
+/*
+ * Heap tuple header. To avoid wasting space, the fields should be
+ * laid out in such a way as to avoid structure padding.
+ *
+ * Datums of composite types (row types) share the same general structure
+ * as on-disk tuples, so that the same routines can be used to build and
+ * examine them. However the requirements are slightly different: a Datum
+ * does not need any transaction visibility information, and it does need
+ * a length word and some embedded type information. We can achieve this
+ * by overlaying the xmin/cmin/xmax/cmax/xvac fields of a heap tuple
+ * with the fields needed in the Datum case. Typically, all tuples built
+ * in-memory will be initialized with the Datum fields; but when a tuple is
+ * about to be inserted in a table, the transaction fields will be filled,
+ * overwriting the datum fields.
+ *
+ * The overall structure of a heap tuple looks like:
+ * fixed fields (HeapTupleHeaderData struct)
+ * nulls bitmap (if HEAP_HASNULL is set in t_infomask)
+ * alignment padding (as needed to make user data MAXALIGN'd)
+ * object ID (if HEAP_HASOID is set in t_infomask)
+ * user data fields
+ *
+ * We store five "virtual" fields Xmin, Cmin, Xmax, Cmax, and Xvac in three
+ * physical fields. Xmin and Xmax are always really stored, but Cmin, Cmax
+ * and Xvac share a field. This works because we know that Cmin and Cmax
+ * are only interesting for the lifetime of the inserting and deleting
+ * transaction respectively. If a tuple is inserted and deleted in the same
+ * transaction, we store a "combo" command id that can be mapped to the real
+ * cmin and cmax, but only by use of local state within the originating
+ * backend. See combocid.c for more details. Meanwhile, Xvac is only set by
+ * old-style VACUUM FULL, which does not have any command sub-structure and so
+ * does not need either Cmin or Cmax. (This requires that old-style VACUUM
+ * FULL never try to move a tuple whose Cmin or Cmax is still interesting,
+ * ie, an insert-in-progress or delete-in-progress tuple.)
+ *
+ * A word about t_ctid: whenever a new tuple is stored on disk, its t_ctid
+ * is initialized with its own TID (location). If the tuple is ever updated,
+ * its t_ctid is changed to point to the replacement version of the tuple.
+ * Thus, a tuple is the latest version of its row iff XMAX is invalid or
+ * t_ctid points to itself (in which case, if XMAX is valid, the tuple is
+ * either locked or deleted). One can follow the chain of t_ctid links
+ * to find the newest version of the row. Beware however that VACUUM might
+ * erase the pointed-to (newer) tuple before erasing the pointing (older)
+ * tuple. Hence, when following a t_ctid link, it is necessary to check
+ * to see if the referenced slot is empty or contains an unrelated tuple.
+ * Check that the referenced tuple has XMIN equal to the referencing tuple's
+ * XMAX to verify that it is actually the descendant version and not an
+ * unrelated tuple stored into a slot recently freed by VACUUM. If either
+ * check fails, one may assume that there is no live descendant version.
+ *
+ * Following the fixed header fields, the nulls bitmap is stored (beginning
+ * at t_bits). The bitmap is *not* stored if t_infomask shows that there
+ * are no nulls in the tuple. If an OID field is present (as indicated by
+ * t_infomask), then it is stored just before the user data, which begins at
+ * the offset shown by t_hoff. Note that t_hoff must be a multiple of
+ * MAXALIGN.
+ */
+
+typedef struct HeapTupleFields
+{
+ TransactionId t_xmin; /* inserting xact ID */
+ TransactionId t_xmax; /* deleting or locking xact ID */
+
+ union
+ {
+ CommandId t_cid; /* inserting or deleting command ID, or both */
+ TransactionId t_xvac; /* old-style VACUUM FULL xact ID */
+ } t_field3;
+} HeapTupleFields;
+
+typedef struct DatumTupleFields
+{
+ int32 datum_len_; /* varlena header (do not touch directly!) */
+
+ int32 datum_typmod; /* -1, or identifier of a record type */
+
+ Oid datum_typeid; /* composite type OID, or RECORDOID */
+
+ /*
+ * Note: field ordering is chosen with thought that Oid might someday
+ * widen to 64 bits.
+ */
+} DatumTupleFields;
+
+struct HeapTupleHeaderData
+{
+ union
+ {
+ HeapTupleFields t_heap;
+ DatumTupleFields t_datum;
+ } t_choice;
+
+ ItemPointerData t_ctid; /* current TID of this or newer tuple */
+
+ /* Fields below here must match MinimalTupleData! */
+
+ uint16 t_infomask2; /* number of attributes + various flags */
+
+ uint16 t_infomask; /* various flag bits, see below */
+
+ uint8 t_hoff; /* sizeof header incl. bitmap, padding */
+
+ /* ^ - 23 bytes - ^ */
+
+ bits8 t_bits[1]; /* bitmap of NULLs -- VARIABLE LENGTH */
+
+ /* MORE DATA FOLLOWS AT END OF STRUCT */
+};
+/* typedef appears in tupbasics.h */
+
+/*
+ * information stored in t_infomask:
+ */
+#define HEAP_HASNULL 0x0001 /* has null attribute(s) */
+#define HEAP_HASVARWIDTH 0x0002 /* has variable-width attribute(s) */
+#define HEAP_HASEXTERNAL 0x0004 /* has external stored attribute(s) */
+#define HEAP_HASOID 0x0008 /* has an object-id field */
+/* bit 0x0010 is available */
+#define HEAP_COMBOCID 0x0020 /* t_cid is a combo cid */
+#define HEAP_XMAX_EXCL_LOCK 0x0040 /* xmax is exclusive locker */
+#define HEAP_XMAX_SHARED_LOCK 0x0080 /* xmax is shared locker */
+/* if either LOCK bit is set, xmax hasn't deleted the tuple, only locked it */
+#define HEAP_IS_LOCKED (HEAP_XMAX_EXCL_LOCK | HEAP_XMAX_SHARED_LOCK)
+#define HEAP_XMIN_COMMITTED 0x0100 /* t_xmin committed */
+#define HEAP_XMIN_INVALID 0x0200 /* t_xmin invalid/aborted */
+#define HEAP_XMAX_COMMITTED 0x0400 /* t_xmax committed */
+#define HEAP_XMAX_INVALID 0x0800 /* t_xmax invalid/aborted */
+#define HEAP_XMAX_IS_MULTI 0x1000 /* t_xmax is a MultiXactId */
+#define HEAP_UPDATED 0x2000 /* this is UPDATEd version of row */
+#define HEAP_MOVED_OFF 0x4000 /* moved to another place by pre-9.0
+ * VACUUM FULL; kept for binary
+ * upgrade support */
+#define HEAP_MOVED_IN 0x8000 /* moved from another place by pre-9.0
+ * VACUUM FULL; kept for binary
+ * upgrade support */
+#define HEAP_MOVED (HEAP_MOVED_OFF | HEAP_MOVED_IN)
+
+#define HEAP_XACT_MASK 0xFFE0 /* visibility-related bits */
+
+/*
+ * information stored in t_infomask2:
+ */
+#define HEAP_NATTS_MASK 0x07FF /* 11 bits for number of attributes */
+/* bits 0x3800 are available */
+#define HEAP_HOT_UPDATED 0x4000 /* tuple was HOT-updated */
+#define HEAP_ONLY_TUPLE 0x8000 /* this is heap-only tuple */
+
+#define HEAP2_XACT_MASK 0xC000 /* visibility-related bits */
+
+/*
+ * HEAP_TUPLE_HAS_MATCH is a temporary flag used during hash joins. It is
+ * only used in tuples that are in the hash table, and those don't need
+ * any visibility information, so we can overlay it on a visibility flag
+ * instead of using up a dedicated bit.
+ */
+#define HEAP_TUPLE_HAS_MATCH HEAP_ONLY_TUPLE /* tuple has a join match */
+
+/*
+ * HeapTupleHeader accessor macros
+ *
+ * Note: beware of multiple evaluations of "tup" argument. But the Set
+ * macros evaluate their other argument only once.
+ */
+
+#define HeapTupleHeaderGetXmin(tup) \
+( \
+ (tup)->t_choice.t_heap.t_xmin \
+)
+
+#define HeapTupleHeaderSetXmin(tup, xid) \
+( \
+ (tup)->t_choice.t_heap.t_xmin = (xid) \
+)
+
+#define HeapTupleHeaderGetXmax(tup) \
+( \
+ (tup)->t_choice.t_heap.t_xmax \
+)
+
+#define HeapTupleHeaderSetXmax(tup, xid) \
+( \
+ (tup)->t_choice.t_heap.t_xmax = (xid) \
+)
+
+/*
+ * HeapTupleHeaderGetRawCommandId will give you what's in the header whether
+ * it is useful or not. Most code should use HeapTupleHeaderGetCmin or
+ * HeapTupleHeaderGetCmax instead, but note that those Assert that you can
+ * get a legitimate result, ie you are in the originating transaction!
+ */
+#define HeapTupleHeaderGetRawCommandId(tup) \
+( \
+ (tup)->t_choice.t_heap.t_field3.t_cid \
+)
+
+/* SetCmin is reasonably simple since we never need a combo CID */
+#define HeapTupleHeaderSetCmin(tup, cid) \
+do { \
+ Assert(!((tup)->t_infomask & HEAP_MOVED)); \
+ (tup)->t_choice.t_heap.t_field3.t_cid = (cid); \
+ (tup)->t_infomask &= ~HEAP_COMBOCID; \
+} while (0)
+
+/* SetCmax must be used after HeapTupleHeaderAdjustCmax; see combocid.c */
+#define HeapTupleHeaderSetCmax(tup, cid, iscombo) \
+do { \
+ Assert(!((tup)->t_infomask & HEAP_MOVED)); \
+ (tup)->t_choice.t_heap.t_field3.t_cid = (cid); \
+ if (iscombo) \
+ (tup)->t_infomask |= HEAP_COMBOCID; \
+ else \
+ (tup)->t_infomask &= ~HEAP_COMBOCID; \
+} while (0)
+
+#define HeapTupleHeaderGetXvac(tup) \
+( \
+ ((tup)->t_infomask & HEAP_MOVED) ? \
+ (tup)->t_choice.t_heap.t_field3.t_xvac \
+ : \
+ InvalidTransactionId \
+)
+
+#define HeapTupleHeaderSetXvac(tup, xid) \
+do { \
+ Assert((tup)->t_infomask & HEAP_MOVED); \
+ (tup)->t_choice.t_heap.t_field3.t_xvac = (xid); \
+} while (0)
+
+#define HeapTupleHeaderGetDatumLength(tup) \
+ VARSIZE(tup)
+
+#define HeapTupleHeaderSetDatumLength(tup, len) \
+ SET_VARSIZE(tup, len)
+
+#define HeapTupleHeaderGetTypeId(tup) \
+( \
+ (tup)->t_choice.t_datum.datum_typeid \
+)
+
+#define HeapTupleHeaderSetTypeId(tup, typeid) \
+( \
+ (tup)->t_choice.t_datum.datum_typeid = (typeid) \
+)
+
+#define HeapTupleHeaderGetTypMod(tup) \
+( \
+ (tup)->t_choice.t_datum.datum_typmod \
+)
+
+#define HeapTupleHeaderSetTypMod(tup, typmod) \
+( \
+ (tup)->t_choice.t_datum.datum_typmod = (typmod) \
+)
+
+#define HeapTupleHeaderGetOid(tup) \
+( \
+ ((tup)->t_infomask & HEAP_HASOID) ? \
+ *((Oid *) ((char *)(tup) + (tup)->t_hoff - sizeof(Oid))) \
+ : \
+ InvalidOid \
+)
+
+#define HeapTupleHeaderSetOid(tup, oid) \
+do { \
+ Assert((tup)->t_infomask & HEAP_HASOID); \
+ *((Oid *) ((char *)(tup) + (tup)->t_hoff - sizeof(Oid))) = (oid); \
+} while (0)
+
+/*
+ * Note that we stop considering a tuple HOT-updated as soon as it is known
+ * aborted or the would-be updating transaction is known aborted. For best
+ * efficiency, check tuple visibility before using this macro, so that the
+ * INVALID bits will be as up to date as possible.
+ */
+#define HeapTupleHeaderIsHotUpdated(tup) \
+( \
+ ((tup)->t_infomask2 & HEAP_HOT_UPDATED) != 0 && \
+ ((tup)->t_infomask & (HEAP_XMIN_INVALID | HEAP_XMAX_INVALID)) == 0 \
+)
+
+#define HeapTupleHeaderSetHotUpdated(tup) \
+( \
+ (tup)->t_infomask2 |= HEAP_HOT_UPDATED \
+)
+
+#define HeapTupleHeaderClearHotUpdated(tup) \
+( \
+ (tup)->t_infomask2 &= ~HEAP_HOT_UPDATED \
+)
+
+#define HeapTupleHeaderIsHeapOnly(tup) \
+( \
+ (tup)->t_infomask2 & HEAP_ONLY_TUPLE \
+)
+
+#define HeapTupleHeaderSetHeapOnly(tup) \
+( \
+ (tup)->t_infomask2 |= HEAP_ONLY_TUPLE \
+)
+
+#define HeapTupleHeaderClearHeapOnly(tup) \
+( \
+ (tup)->t_infomask2 &= ~HEAP_ONLY_TUPLE \
+)
+
+#define HeapTupleHeaderHasMatch(tup) \
+( \
+ (tup)->t_infomask2 & HEAP_TUPLE_HAS_MATCH \
+)
+
+#define HeapTupleHeaderSetMatch(tup) \
+( \
+ (tup)->t_infomask2 |= HEAP_TUPLE_HAS_MATCH \
+)
+
+#define HeapTupleHeaderClearMatch(tup) \
+( \
+ (tup)->t_infomask2 &= ~HEAP_TUPLE_HAS_MATCH \
+)
+
+#define HeapTupleHeaderGetNatts(tup) \
+ ((tup)->t_infomask2 & HEAP_NATTS_MASK)
+
+#define HeapTupleHeaderSetNatts(tup, natts) \
+( \
+ (tup)->t_infomask2 = ((tup)->t_infomask2 & ~HEAP_NATTS_MASK) | (natts) \
+)
+
+
+/*
+ * BITMAPLEN(NATTS) -
+ * Computes size of null bitmap given number of data columns.
+ */
+#define BITMAPLEN(NATTS) (((int)(NATTS) + 7) / 8)
+
+/*
+ * MaxHeapTupleSize is the maximum allowed size of a heap tuple, including
+ * header and MAXALIGN alignment padding. Basically it's BLCKSZ minus the
+ * other stuff that has to be on a disk page. Since heap pages use no
+ * "special space", there's no deduction for that.
+ *
+ * NOTE: we allow for the ItemId that must point to the tuple, ensuring that
+ * an otherwise-empty page can indeed hold a tuple of this size. Because
+ * ItemIds and tuples have different alignment requirements, don't assume that
+ * you can, say, fit 2 tuples of size MaxHeapTupleSize/2 on the same page.
+ */
+#define MaxHeapTupleSize (BLCKSZ - MAXALIGN(SizeOfPageHeaderData + sizeof(ItemIdData)))
+
+/*
+ * MaxHeapTuplesPerPage is an upper bound on the number of tuples that can
+ * fit on one heap page. (Note that indexes could have more, because they
+ * use a smaller tuple header.) We arrive at the divisor because each tuple
+ * must be maxaligned, and it must have an associated item pointer.
+ *
+ * Note: with HOT, there could theoretically be more line pointers (not actual
+ * tuples) than this on a heap page. However we constrain the number of line
+ * pointers to this anyway, to avoid excessive line-pointer bloat and not
+ * require increases in the size of work arrays.
+ */
+#define MaxHeapTuplesPerPage \
+ ((int) ((BLCKSZ - SizeOfPageHeaderData) / \
+ (MAXALIGN(offsetof(HeapTupleHeaderData, t_bits)) + sizeof(ItemIdData))))
+
+/*
+ * MaxAttrSize is a somewhat arbitrary upper limit on the declared size of
+ * data fields of char(n) and similar types. It need not have anything
+ * directly to do with the *actual* upper limit of varlena values, which
+ * is currently 1Gb (see TOAST structures in postgres.h). I've set it
+ * at 10Mb which seems like a reasonable number --- tgl 8/6/00.
+ */
+#define MaxAttrSize (10 * 1024 * 1024)
+
+
+/*
+ * 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
+ * is worthwhile because we need to store many tuples. The representation
+ * is chosen so that tuple access routines can work with either full or
+ * minimal tuples via a HeapTupleData pointer structure. The access routines
+ * see no difference, except that they must not access the transaction status
+ * or t_ctid fields because those aren't there.
+ *
+ * For the most part, MinimalTuples should be accessed via TupleTableSlot
+ * routines. These routines will prevent access to the "system columns"
+ * and thereby prevent accidental use of the nonexistent fields.
+ *
+ * MinimalTupleData contains a length word, some padding, and fields matching
+ * HeapTupleHeaderData beginning with t_infomask2. The padding is chosen so
+ * that offsetof(t_infomask2) is the same modulo MAXIMUM_ALIGNOF in both
+ * structs. This makes data alignment rules equivalent in both cases.
+ *
+ * When a minimal tuple is accessed via a HeapTupleData pointer, t_data is
+ * set to point MINIMAL_TUPLE_OFFSET bytes before the actual start of the
+ * minimal tuple --- that is, where a full tuple matching the minimal tuple's
+ * data would start. This trick is what makes the structs seem equivalent.
+ *
+ * Note that t_hoff is computed the same as in a full tuple, hence it includes
+ * the MINIMAL_TUPLE_OFFSET distance. t_len does not include that, however.
+ *
+ * MINIMAL_TUPLE_DATA_OFFSET is the offset to the first useful (non-pad) data
+ * other than the length word. tuplesort.c and tuplestore.c use this to avoid
+ * writing the padding to disk.
+ */
+#define MINIMAL_TUPLE_OFFSET \
+ ((offsetof(HeapTupleHeaderData, t_infomask2) - sizeof(uint32)) / MAXIMUM_ALIGNOF * MAXIMUM_ALIGNOF)
+#define MINIMAL_TUPLE_PADDING \
+ ((offsetof(HeapTupleHeaderData, t_infomask2) - sizeof(uint32)) % MAXIMUM_ALIGNOF)
+#define MINIMAL_TUPLE_DATA_OFFSET \
+ offsetof(MinimalTupleData, t_infomask2)
+
+struct MinimalTupleData
+{
+ uint32 t_len; /* actual length of minimal tuple */
+
+ char mt_padding[MINIMAL_TUPLE_PADDING];
+
+ /* Fields below here must match HeapTupleHeaderData! */
+
+ uint16 t_infomask2; /* number of attributes + various flags */
+
+ uint16 t_infomask; /* various flag bits, see below */
+
+ uint8 t_hoff; /* sizeof header incl. bitmap, padding */
+
+ /* ^ - 23 bytes - ^ */
+
+ bits8 t_bits[1]; /* bitmap of NULLs -- VARIABLE LENGTH */
+
+ /* MORE DATA FOLLOWS AT END OF STRUCT */
+};
+/* typedef appears in htup.h */
+
+
+/*
+ * GETSTRUCT - given a HeapTuple pointer, return address of the user data
+ */
+#define GETSTRUCT(TUP) ((char *) ((TUP)->t_data) + (TUP)->t_data->t_hoff)
+
+/*
+ * Accessor macros to be used with HeapTuple pointers.
+ */
+
+#define HeapTupleHasNulls(tuple) \
+ (((tuple)->t_data->t_infomask & HEAP_HASNULL) != 0)
+
+#define HeapTupleNoNulls(tuple) \
+ (!((tuple)->t_data->t_infomask & HEAP_HASNULL))
+
+#define HeapTupleHasVarWidth(tuple) \
+ (((tuple)->t_data->t_infomask & HEAP_HASVARWIDTH) != 0)
+
+#define HeapTupleAllFixed(tuple) \
+ (!((tuple)->t_data->t_infomask & HEAP_HASVARWIDTH))
+
+#define HeapTupleHasExternal(tuple) \
+ (((tuple)->t_data->t_infomask & HEAP_HASEXTERNAL) != 0)
+
+#define HeapTupleIsHotUpdated(tuple) \
+ HeapTupleHeaderIsHotUpdated((tuple)->t_data)
+
+#define HeapTupleSetHotUpdated(tuple) \
+ HeapTupleHeaderSetHotUpdated((tuple)->t_data)
+
+#define HeapTupleClearHotUpdated(tuple) \
+ HeapTupleHeaderClearHotUpdated((tuple)->t_data)
+
+#define HeapTupleIsHeapOnly(tuple) \
+ HeapTupleHeaderIsHeapOnly((tuple)->t_data)
+
+#define HeapTupleSetHeapOnly(tuple) \
+ HeapTupleHeaderSetHeapOnly((tuple)->t_data)
+
+#define HeapTupleClearHeapOnly(tuple) \
+ HeapTupleHeaderClearHeapOnly((tuple)->t_data)
+
+#define HeapTupleGetOid(tuple) \
+ HeapTupleHeaderGetOid((tuple)->t_data)
+
+#define HeapTupleSetOid(tuple, oid) \
+ HeapTupleHeaderSetOid((tuple)->t_data, (oid))
+
+
+/* ----------------
+ * 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) = false), \
+ 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)) \
+ ) \
+ : \
+ ( \
+ att_isnull((attnum)-1, (tup)->t_data->t_bits) ? \
+ ( \
+ (*(isnull) = true), \
+ (Datum)NULL \
+ ) \
+ : \
+ ( \
+ nocachegetattr((tup), (attnum), (tupleDesc)) \
+ ) \
+ ) \
+)
+#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) \
+ ( \
+ ((attnum) > 0) ? \
+ ( \
+ ((attnum) > (int) HeapTupleHeaderGetNatts((tup)->t_data)) ? \
+ ( \
+ (*(isnull) = true), \
+ (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);
+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_modify_tuple(HeapTuple tuple,
+ TupleDesc tupleDesc,
+ Datum *replValues,
+ bool *replIsnull,
+ bool *doReplace);
+extern void heap_deform_tuple(HeapTuple tuple, TupleDesc tupleDesc,
+ Datum *values, bool *isnull);
+
+/* these three are deprecated versions of the three above: */
+extern HeapTuple heap_formtuple(TupleDesc tupleDescriptor,
+ Datum *values, char *nulls);
+extern HeapTuple heap_modifytuple(HeapTuple tuple,
+ TupleDesc tupleDesc,
+ Datum *replValues,
+ char *replNulls,
+ char *replActions);
+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);
+
+#endif /* HTUP_DETAILS_H */
diff --git a/src/include/access/reloptions.h b/src/include/access/reloptions.h
index 42af4a9bbcf..0572b252759 100644
--- a/src/include/access/reloptions.h
+++ b/src/include/access/reloptions.h
@@ -20,6 +20,7 @@
#define RELOPTIONS_H
#include "access/htup.h"
+#include "access/tupdesc.h"
#include "nodes/pg_list.h"
/* types supported by reloptions */
diff --git a/src/include/access/relscan.h b/src/include/access/relscan.h
index 2e967e1d597..87acc8eb5bb 100644
--- a/src/include/access/relscan.h
+++ b/src/include/access/relscan.h
@@ -16,6 +16,7 @@
#include "access/genam.h"
#include "access/heapam.h"
+#include "access/htup_details.h"
#include "access/itup.h"
#include "access/tupdesc.h"
diff --git a/src/include/access/tupconvert.h b/src/include/access/tupconvert.h
index 7511aa64051..342dbb4d25f 100644
--- a/src/include/access/tupconvert.h
+++ b/src/include/access/tupconvert.h
@@ -15,6 +15,7 @@
#define TUPCONVERT_H
#include "access/htup.h"
+#include "access/tupdesc.h"
typedef struct TupleConversionMap
diff --git a/src/include/access/tuptoaster.h b/src/include/access/tuptoaster.h
index e3dbde0def4..0f29acb244e 100644
--- a/src/include/access/tuptoaster.h
+++ b/src/include/access/tuptoaster.h
@@ -13,7 +13,7 @@
#ifndef TUPTOASTER_H
#define TUPTOASTER_H
-#include "access/htup.h"
+#include "access/htup_details.h"
#include "utils/relcache.h"
/*
diff --git a/src/include/executor/tuptable.h b/src/include/executor/tuptable.h
index 4db8c878c0c..19c83fe75b6 100644
--- a/src/include/executor/tuptable.h
+++ b/src/include/executor/tuptable.h
@@ -15,6 +15,7 @@
#define TUPTABLE_H
#include "access/htup.h"
+#include "access/tupdesc.h"
#include "storage/buf.h"
/*----------
diff --git a/src/include/utils/inval.h b/src/include/utils/inval.h
index c8815e52ebf..c5549a62126 100644
--- a/src/include/utils/inval.h
+++ b/src/include/utils/inval.h
@@ -15,6 +15,7 @@
#define INVAL_H
#include "access/htup.h"
+#include "storage/relfilenode.h"
#include "utils/relcache.h"
diff --git a/src/include/utils/lsyscache.h b/src/include/utils/lsyscache.h
index 4bf1029e109..e88aa1ac06e 100644
--- a/src/include/utils/lsyscache.h
+++ b/src/include/utils/lsyscache.h
@@ -13,7 +13,9 @@
#ifndef LSYSCACHE_H
#define LSYSCACHE_H
+#include "access/attnum.h"
#include "access/htup.h"
+#include "nodes/pg_list.h"
/* Result list element for get_op_btree_interpretation */
typedef struct OpBtreeInterpretation
diff --git a/src/pl/plperl/plperl.c b/src/pl/plperl/plperl.c
index 4415efafec0..cf83cc63727 100644
--- a/src/pl/plperl/plperl.c
+++ b/src/pl/plperl/plperl.c
@@ -16,6 +16,7 @@
#include <locale.h>
/* postgreSQL stuff */
+#include "access/htup_details.h"
#include "access/xact.h"
#include "catalog/pg_language.h"
#include "catalog/pg_proc.h"
diff --git a/src/pl/plpgsql/src/pl_comp.c b/src/pl/plpgsql/src/pl_comp.c
index 0dc0e0b37ed..35f57213719 100644
--- a/src/pl/plpgsql/src/pl_comp.c
+++ b/src/pl/plpgsql/src/pl_comp.c
@@ -17,6 +17,7 @@
#include <ctype.h>
+#include "access/htup_details.h"
#include "catalog/namespace.h"
#include "catalog/pg_proc.h"
#include "catalog/pg_proc_fn.h"
diff --git a/src/pl/plpgsql/src/pl_exec.c b/src/pl/plpgsql/src/pl_exec.c
index 8b649a4e5dc..3b5b3bbae2d 100644
--- a/src/pl/plpgsql/src/pl_exec.c
+++ b/src/pl/plpgsql/src/pl_exec.c
@@ -17,6 +17,7 @@
#include <ctype.h>
+#include "access/htup_details.h"
#include "access/transam.h"
#include "access/tupconvert.h"
#include "catalog/pg_proc.h"
diff --git a/src/pl/plpgsql/src/pl_handler.c b/src/pl/plpgsql/src/pl_handler.c
index 63c3abd9b0b..fa74e7d7a52 100644
--- a/src/pl/plpgsql/src/pl_handler.c
+++ b/src/pl/plpgsql/src/pl_handler.c
@@ -15,6 +15,7 @@
#include "plpgsql.h"
+#include "access/htup_details.h"
#include "catalog/pg_proc.h"
#include "catalog/pg_type.h"
#include "funcapi.h"
diff --git a/src/pl/plpython/plpy_exec.c b/src/pl/plpython/plpy_exec.c
index 96ee26c35c7..b2425edd6b4 100644
--- a/src/pl/plpython/plpy_exec.c
+++ b/src/pl/plpython/plpy_exec.c
@@ -6,6 +6,7 @@
#include "postgres.h"
+#include "access/htup_details.h"
#include "access/xact.h"
#include "catalog/pg_type.h"
#include "commands/trigger.h"
diff --git a/src/pl/plpython/plpy_main.c b/src/pl/plpython/plpy_main.c
index 494ec37ea7c..8b61f1a972f 100644
--- a/src/pl/plpython/plpy_main.c
+++ b/src/pl/plpython/plpy_main.c
@@ -6,6 +6,7 @@
#include "postgres.h"
+#include "access/htup_details.h"
#include "catalog/pg_proc.h"
#include "catalog/pg_type.h"
#include "commands/trigger.h"
diff --git a/src/pl/plpython/plpy_procedure.c b/src/pl/plpython/plpy_procedure.c
index 7fb5f00e0f2..a28cb9a41f3 100644
--- a/src/pl/plpython/plpy_procedure.c
+++ b/src/pl/plpython/plpy_procedure.c
@@ -6,6 +6,7 @@
#include "postgres.h"
+#include "access/htup_details.h"
#include "access/transam.h"
#include "funcapi.h"
#include "catalog/pg_proc.h"
diff --git a/src/pl/plpython/plpy_spi.c b/src/pl/plpython/plpy_spi.c
index 00156e6658e..a65af37e657 100644
--- a/src/pl/plpython/plpy_spi.c
+++ b/src/pl/plpython/plpy_spi.c
@@ -6,6 +6,7 @@
#include "postgres.h"
+#include "access/htup_details.h"
#include "access/xact.h"
#include "catalog/pg_type.h"
#include "executor/spi_priv.h"
diff --git a/src/pl/plpython/plpy_typeio.c b/src/pl/plpython/plpy_typeio.c
index 2cc7bbbd4de..2402c151a4f 100644
--- a/src/pl/plpython/plpy_typeio.c
+++ b/src/pl/plpython/plpy_typeio.c
@@ -6,6 +6,7 @@
#include "postgres.h"
+#include "access/htup_details.h"
#include "access/transam.h"
#include "catalog/pg_type.h"
#include "funcapi.h"
diff --git a/src/pl/plpython/plpy_typeio.h b/src/pl/plpython/plpy_typeio.h
index d2dfa66e0b2..82e472a3127 100644
--- a/src/pl/plpython/plpy_typeio.h
+++ b/src/pl/plpython/plpy_typeio.h
@@ -6,6 +6,7 @@
#define PLPY_TYPEIO_H
#include "access/htup.h"
+#include "access/tupdesc.h"
#include "fmgr.h"
#include "storage/itemptr.h"
diff --git a/src/pl/tcl/pltcl.c b/src/pl/tcl/pltcl.c
index ecde90626bf..d329e9def81 100644
--- a/src/pl/tcl/pltcl.c
+++ b/src/pl/tcl/pltcl.c
@@ -18,6 +18,7 @@
#define CONST84
#endif
+#include "access/htup_details.h"
#include "access/xact.h"
#include "catalog/pg_proc.h"
#include "catalog/pg_type.h"