From 1cc402987b4f296c2ce9138d0e5741a16cae3aca Mon Sep 17 00:00:00 2001
From: Peter Eisentraut <peter_e@gmx.net>
Date: Wed, 16 Aug 2017 00:22:32 -0400
Subject: [PATCH v5 1/4] Add bool8 typedef for system catalog structs

For system catalog structs, we require that the C bool type is 1 byte in
size, the same as the SQL type.  But if stdbool.h is used, then this is
not guaranteed.  To address that, define a separate type bool8 that is
guaranteed to be 1 byte, and use that in the system catalog structs.
Some tweaking in Catalog.pm ensures that bool is not accidentally used
where bool8 should be used.
---
 src/backend/catalog/Catalog.pm        |  2 ++
 src/include/c.h                       |  9 +++++++++
 src/include/catalog/pg_aggregate.h    |  4 ++--
 src/include/catalog/pg_attribute.h    | 10 +++++-----
 src/include/catalog/pg_auth_members.h |  2 +-
 src/include/catalog/pg_authid.h       | 14 +++++++-------
 src/include/catalog/pg_class.h        | 22 +++++++++++-----------
 src/include/catalog/pg_constraint.h   | 10 +++++-----
 src/include/catalog/pg_conversion.h   |  2 +-
 src/include/catalog/pg_database.h     |  4 ++--
 src/include/catalog/pg_extension.h    |  2 +-
 src/include/catalog/pg_index.h        | 20 ++++++++++----------
 src/include/catalog/pg_language.h     |  4 ++--
 src/include/catalog/pg_opclass.h      |  2 +-
 src/include/catalog/pg_operator.h     |  4 ++--
 src/include/catalog/pg_pltemplate.h   |  4 ++--
 src/include/catalog/pg_policy.h       |  2 +-
 src/include/catalog/pg_proc.h         | 12 ++++++------
 src/include/catalog/pg_publication.h  |  8 ++++----
 src/include/catalog/pg_rewrite.h      |  2 +-
 src/include/catalog/pg_sequence.h     |  2 +-
 src/include/catalog/pg_statistic.h    |  2 +-
 src/include/catalog/pg_subscription.h |  2 +-
 src/include/catalog/pg_trigger.h      |  6 +++---
 src/include/catalog/pg_type.h         |  8 ++++----
 src/include/commands/sequence.h       |  2 +-
 26 files changed, 86 insertions(+), 75 deletions(-)

diff --git a/src/backend/catalog/Catalog.pm b/src/backend/catalog/Catalog.pm
index 80bd9771f1..2602c68867 100644
--- a/src/backend/catalog/Catalog.pm
+++ b/src/backend/catalog/Catalog.pm
@@ -26,6 +26,8 @@ sub Catalogs
 	# There are a few types which are given one name in the C source, but a
 	# different name at the SQL level.  These are enumerated here.
 	my %RENAME_ATTTYPE = (
+		'bool'          => 'INVALID',  # use bool8 instead
+		'bool8'         => 'bool',
 		'int16'         => 'int2',
 		'int32'         => 'int4',
 		'int64'         => 'int8',
diff --git a/src/include/c.h b/src/include/c.h
index 22535a7deb..20c15a0d9d 100644
--- a/src/include/c.h
+++ b/src/include/c.h
@@ -267,6 +267,15 @@ typedef char bool;
 
 #endif							/* not C++ */
 
+/*
+ * bool8
+ *
+ * A bool type that is guaranteed to be 8 bits/1 byte, mainly for use in
+ * system catalog definitions.  (stdbool.h's bool is not 1 byte on all
+ * platforms.)
+ */
+typedef char bool8;
+
 
 /* ----------------------------------------------------------------
  *				Section 3:	standard system types
diff --git a/src/include/catalog/pg_aggregate.h b/src/include/catalog/pg_aggregate.h
index 13f1bce5af..a8894b9aad 100644
--- a/src/include/catalog/pg_aggregate.h
+++ b/src/include/catalog/pg_aggregate.h
@@ -65,8 +65,8 @@ CATALOG(pg_aggregate,2600) BKI_WITHOUT_OIDS
 	regproc		aggmtransfn;
 	regproc		aggminvtransfn;
 	regproc		aggmfinalfn;
-	bool		aggfinalextra;
-	bool		aggmfinalextra;
+	bool8		aggfinalextra;
+	bool8		aggmfinalextra;
 	char		aggfinalmodify;
 	char		aggmfinalmodify;
 	Oid			aggsortop;
diff --git a/src/include/catalog/pg_attribute.h b/src/include/catalog/pg_attribute.h
index bcf28e8f04..a2007560ae 100644
--- a/src/include/catalog/pg_attribute.h
+++ b/src/include/catalog/pg_attribute.h
@@ -104,7 +104,7 @@ CATALOG(pg_attribute,1249) BKI_BOOTSTRAP BKI_WITHOUT_OIDS BKI_ROWTYPE_OID(75) BK
 	 * attbyval is a copy of the typbyval field from pg_type for this
 	 * attribute.  See atttypid comments above.
 	 */
-	bool		attbyval;
+	bool8		attbyval;
 
 	/*----------
 	 * attstorage tells for VARLENA attributes, what the heap access
@@ -128,16 +128,16 @@ CATALOG(pg_attribute,1249) BKI_BOOTSTRAP BKI_WITHOUT_OIDS BKI_ROWTYPE_OID(75) BK
 	char		attalign;
 
 	/* This flag represents the "NOT NULL" constraint */
-	bool		attnotnull;
+	bool8		attnotnull;
 
 	/* Has DEFAULT value or not */
-	bool		atthasdef;
+	bool8		atthasdef;
 
 	/* One of the ATTRIBUTE_IDENTITY_* constants below, or '\0' */
 	char		attidentity;
 
 	/* Is dropped (ie, logically invisible) or not */
-	bool		attisdropped;
+	bool8		attisdropped;
 
 	/*
 	 * This flag specifies whether this column has ever had a local
@@ -148,7 +148,7 @@ CATALOG(pg_attribute,1249) BKI_BOOTSTRAP BKI_WITHOUT_OIDS BKI_ROWTYPE_OID(75) BK
 	 * not dropped by a parent's DROP COLUMN even if this causes the column's
 	 * attinhcount to become zero.
 	 */
-	bool		attislocal;
+	bool8		attislocal;
 
 	/* Number of times inherited from direct parent relation(s) */
 	int32		attinhcount;
diff --git a/src/include/catalog/pg_auth_members.h b/src/include/catalog/pg_auth_members.h
index 6a954fff97..43a8549659 100644
--- a/src/include/catalog/pg_auth_members.h
+++ b/src/include/catalog/pg_auth_members.h
@@ -34,7 +34,7 @@ CATALOG(pg_auth_members,1261) BKI_SHARED_RELATION BKI_WITHOUT_OIDS BKI_ROWTYPE_O
 	Oid			roleid;			/* ID of a role */
 	Oid			member;			/* ID of a member of that role */
 	Oid			grantor;		/* who granted the membership */
-	bool		admin_option;	/* granted with admin option? */
+	bool8		admin_option;	/* granted with admin option? */
 } FormData_pg_auth_members;
 
 /* ----------------
diff --git a/src/include/catalog/pg_authid.h b/src/include/catalog/pg_authid.h
index 9b6b52c9f9..b44328fe38 100644
--- a/src/include/catalog/pg_authid.h
+++ b/src/include/catalog/pg_authid.h
@@ -45,13 +45,13 @@
 CATALOG(pg_authid,1260) BKI_SHARED_RELATION BKI_ROWTYPE_OID(2842) BKI_SCHEMA_MACRO
 {
 	NameData	rolname;		/* name of role */
-	bool		rolsuper;		/* read this field via superuser() only! */
-	bool		rolinherit;		/* inherit privileges from other roles? */
-	bool		rolcreaterole;	/* allowed to create more roles? */
-	bool		rolcreatedb;	/* allowed to create databases? */
-	bool		rolcanlogin;	/* allowed to log in as session user? */
-	bool		rolreplication; /* role used for streaming replication */
-	bool		rolbypassrls;	/* bypasses row level security? */
+	bool8		rolsuper;		/* read this field via superuser() only! */
+	bool8		rolinherit;		/* inherit privileges from other roles? */
+	bool8		rolcreaterole;	/* allowed to create more roles? */
+	bool8		rolcreatedb;	/* allowed to create databases? */
+	bool8		rolcanlogin;	/* allowed to log in as session user? */
+	bool8		rolreplication; /* role used for streaming replication */
+	bool8		rolbypassrls;	/* bypasses row level security? */
 	int32		rolconnlimit;	/* max connections allowed (-1=no limit) */
 
 	/* remaining fields may be null; use heap_getattr to read them! */
diff --git a/src/include/catalog/pg_class.h b/src/include/catalog/pg_class.h
index b256657bda..8e98c3174d 100644
--- a/src/include/catalog/pg_class.h
+++ b/src/include/catalog/pg_class.h
@@ -48,8 +48,8 @@ CATALOG(pg_class,1259) BKI_BOOTSTRAP BKI_ROWTYPE_OID(83) BKI_SCHEMA_MACRO
 	int32		relallvisible;	/* # of all-visible blocks (not always
 								 * up-to-date) */
 	Oid			reltoastrelid;	/* OID of toast table; 0 if none */
-	bool		relhasindex;	/* T if has (or has had) any indexes */
-	bool		relisshared;	/* T if shared across databases */
+	bool8		relhasindex;	/* T if has (or has had) any indexes */
+	bool8		relisshared;	/* T if shared across databases */
 	char		relpersistence; /* see RELPERSISTENCE_xxx constants below */
 	char		relkind;		/* see RELKIND_xxx constants below */
 	int16		relnatts;		/* number of user attributes */
@@ -60,17 +60,17 @@ CATALOG(pg_class,1259) BKI_BOOTSTRAP BKI_ROWTYPE_OID(83) BKI_SCHEMA_MACRO
 	 * contain entries with negative attnums for system attributes.
 	 */
 	int16		relchecks;		/* # of CHECK constraints for class */
-	bool		relhasoids;		/* T if we generate OIDs for rows of rel */
-	bool		relhaspkey;		/* has (or has had) PRIMARY KEY index */
-	bool		relhasrules;	/* has (or has had) any rules */
-	bool		relhastriggers; /* has (or has had) any TRIGGERs */
-	bool		relhassubclass; /* has (or has had) derived classes */
-	bool		relrowsecurity; /* row security is enabled or not */
-	bool		relforcerowsecurity;	/* row security forced for owners or
+	bool8		relhasoids;		/* T if we generate OIDs for rows of rel */
+	bool8		relhaspkey;		/* has (or has had) PRIMARY KEY index */
+	bool8		relhasrules;	/* has (or has had) any rules */
+	bool8		relhastriggers; /* has (or has had) any TRIGGERs */
+	bool8		relhassubclass; /* has (or has had) derived classes */
+	bool8		relrowsecurity; /* row security is enabled or not */
+	bool8		relforcerowsecurity;	/* row security forced for owners or
 										 * not */
-	bool		relispopulated; /* matview currently holds query results */
+	bool8		relispopulated; /* matview currently holds query results */
 	char		relreplident;	/* see REPLICA_IDENTITY_xxx constants  */
-	bool		relispartition; /* is relation a partition? */
+	bool8		relispartition; /* is relation a partition? */
 	TransactionId relfrozenxid; /* all Xids < this are frozen in this rel */
 	TransactionId relminmxid;	/* all multixacts in this rel are >= this.
 								 * this is really a MultiXactId */
diff --git a/src/include/catalog/pg_constraint.h b/src/include/catalog/pg_constraint.h
index ec035d8434..216344e254 100644
--- a/src/include/catalog/pg_constraint.h
+++ b/src/include/catalog/pg_constraint.h
@@ -42,9 +42,9 @@ CATALOG(pg_constraint,2606)
 	NameData	conname;		/* name of this constraint */
 	Oid			connamespace;	/* OID of namespace containing constraint */
 	char		contype;		/* constraint type; see codes below */
-	bool		condeferrable;	/* deferrable constraint? */
-	bool		condeferred;	/* deferred by default? */
-	bool		convalidated;	/* constraint has been validated? */
+	bool8		condeferrable;	/* deferrable constraint? */
+	bool8		condeferred;	/* deferred by default? */
+	bool8		convalidated;	/* constraint has been validated? */
 
 	/*
 	 * conrelid and conkey are only meaningful if the constraint applies to a
@@ -82,13 +82,13 @@ CATALOG(pg_constraint,2606)
 	char		confmatchtype;	/* foreign key's match type */
 
 	/* Has a local definition (hence, do not drop when coninhcount is 0) */
-	bool		conislocal;
+	bool8		conislocal;
 
 	/* Number of times inherited from direct parent relation(s) */
 	int32		coninhcount;
 
 	/* Has a local definition and cannot be inherited */
-	bool		connoinherit;
+	bool8		connoinherit;
 
 #ifdef CATALOG_VARLEN			/* variable-length fields start here */
 
diff --git a/src/include/catalog/pg_conversion.h b/src/include/catalog/pg_conversion.h
index 9344585e66..33c61e47cc 100644
--- a/src/include/catalog/pg_conversion.h
+++ b/src/include/catalog/pg_conversion.h
@@ -45,7 +45,7 @@ CATALOG(pg_conversion,2607)
 	int32		conforencoding;
 	int32		contoencoding;
 	regproc		conproc;
-	bool		condefault;
+	bool8		condefault;
 } FormData_pg_conversion;
 
 /* ----------------
diff --git a/src/include/catalog/pg_database.h b/src/include/catalog/pg_database.h
index e7cbca49cf..e470abf88a 100644
--- a/src/include/catalog/pg_database.h
+++ b/src/include/catalog/pg_database.h
@@ -36,8 +36,8 @@ CATALOG(pg_database,1262) BKI_SHARED_RELATION BKI_ROWTYPE_OID(1248) BKI_SCHEMA_M
 	int32		encoding;		/* character encoding */
 	NameData	datcollate;		/* LC_COLLATE setting */
 	NameData	datctype;		/* LC_CTYPE setting */
-	bool		datistemplate;	/* allowed as CREATE DATABASE template? */
-	bool		datallowconn;	/* new connections allowed? */
+	bool8		datistemplate;	/* allowed as CREATE DATABASE template? */
+	bool8		datallowconn;	/* new connections allowed? */
 	int32		datconnlimit;	/* max connections allowed (-1=no limit) */
 	Oid			datlastsysoid;	/* highest OID to consider a system OID */
 	TransactionId datfrozenxid; /* all Xids < this are frozen in this DB */
diff --git a/src/include/catalog/pg_extension.h b/src/include/catalog/pg_extension.h
index 2ce575d17e..21e6153d21 100644
--- a/src/include/catalog/pg_extension.h
+++ b/src/include/catalog/pg_extension.h
@@ -33,7 +33,7 @@ CATALOG(pg_extension,3079)
 	NameData	extname;		/* extension name */
 	Oid			extowner;		/* extension owner */
 	Oid			extnamespace;	/* namespace of contained objects */
-	bool		extrelocatable; /* if true, allow ALTER EXTENSION SET SCHEMA */
+	bool8		extrelocatable; /* if true, allow ALTER EXTENSION SET SCHEMA */
 
 #ifdef CATALOG_VARLEN			/* variable-length fields start here */
 	/* extversion may never be null, but the others can be. */
diff --git a/src/include/catalog/pg_index.h b/src/include/catalog/pg_index.h
index 8505c3be5f..1d21e9800c 100644
--- a/src/include/catalog/pg_index.h
+++ b/src/include/catalog/pg_index.h
@@ -33,16 +33,16 @@ CATALOG(pg_index,2610) BKI_WITHOUT_OIDS BKI_SCHEMA_MACRO
 	Oid			indexrelid;		/* OID of the index */
 	Oid			indrelid;		/* OID of the relation it indexes */
 	int16		indnatts;		/* number of columns in index */
-	bool		indisunique;	/* is this a unique index? */
-	bool		indisprimary;	/* is this index for primary key? */
-	bool		indisexclusion; /* is this index for exclusion constraint? */
-	bool		indimmediate;	/* is uniqueness enforced immediately? */
-	bool		indisclustered; /* is this the index last clustered by? */
-	bool		indisvalid;		/* is this index valid for use by queries? */
-	bool		indcheckxmin;	/* must we wait for xmin to be old? */
-	bool		indisready;		/* is this index ready for inserts? */
-	bool		indislive;		/* is this index alive at all? */
-	bool		indisreplident; /* is this index the identity for replication? */
+	bool8		indisunique;	/* is this a unique index? */
+	bool8		indisprimary;	/* is this index for primary key? */
+	bool8		indisexclusion; /* is this index for exclusion constraint? */
+	bool8		indimmediate;	/* is uniqueness enforced immediately? */
+	bool8		indisclustered; /* is this the index last clustered by? */
+	bool8		indisvalid;		/* is this index valid for use by queries? */
+	bool8		indcheckxmin;	/* must we wait for xmin to be old? */
+	bool8		indisready;		/* is this index ready for inserts? */
+	bool8		indislive;		/* is this index alive at all? */
+	bool8		indisreplident; /* is this index the identity for replication? */
 
 	/* variable-length fields start here, but we allow direct access to indkey */
 	int2vector	indkey;			/* column numbers of indexed cols, or 0 */
diff --git a/src/include/catalog/pg_language.h b/src/include/catalog/pg_language.h
index ad244e839b..4c20e66a6c 100644
--- a/src/include/catalog/pg_language.h
+++ b/src/include/catalog/pg_language.h
@@ -32,8 +32,8 @@ CATALOG(pg_language,2612)
 {
 	NameData	lanname;		/* Language name */
 	Oid			lanowner;		/* Language's owner */
-	bool		lanispl;		/* Is a procedural language */
-	bool		lanpltrusted;	/* PL is trusted */
+	bool8		lanispl;		/* Is a procedural language */
+	bool8		lanpltrusted;	/* PL is trusted */
 	Oid			lanplcallfoid;	/* Call handler for PL */
 	Oid			laninline;		/* Optional anonymous-block handler function */
 	Oid			lanvalidator;	/* Optional validation function */
diff --git a/src/include/catalog/pg_opclass.h b/src/include/catalog/pg_opclass.h
index 6aabc7279f..b35181ce74 100644
--- a/src/include/catalog/pg_opclass.h
+++ b/src/include/catalog/pg_opclass.h
@@ -56,7 +56,7 @@ CATALOG(pg_opclass,2616)
 	Oid			opcowner;		/* opclass owner */
 	Oid			opcfamily;		/* containing operator family */
 	Oid			opcintype;		/* type of data indexed by opclass */
-	bool		opcdefault;		/* T if opclass is default for opcintype */
+	bool8		opcdefault;		/* T if opclass is default for opcintype */
 	Oid			opckeytype;		/* type of data in index, or InvalidOid */
 } FormData_pg_opclass;
 
diff --git a/src/include/catalog/pg_operator.h b/src/include/catalog/pg_operator.h
index ff9b47077b..24c1c72759 100644
--- a/src/include/catalog/pg_operator.h
+++ b/src/include/catalog/pg_operator.h
@@ -37,8 +37,8 @@ CATALOG(pg_operator,2617)
 	Oid			oprnamespace;	/* OID of namespace containing this oper */
 	Oid			oprowner;		/* operator owner */
 	char		oprkind;		/* 'l', 'r', or 'b' */
-	bool		oprcanmerge;	/* can be used in merge join? */
-	bool		oprcanhash;		/* can be used in hash join? */
+	bool8		oprcanmerge;	/* can be used in merge join? */
+	bool8		oprcanhash;		/* can be used in hash join? */
 	Oid			oprleft;		/* left arg type, or 0 if 'l' oprkind */
 	Oid			oprright;		/* right arg type, or 0 if 'r' oprkind */
 	Oid			oprresult;		/* result datatype */
diff --git a/src/include/catalog/pg_pltemplate.h b/src/include/catalog/pg_pltemplate.h
index fbe71bd0c3..c4d416c686 100644
--- a/src/include/catalog/pg_pltemplate.h
+++ b/src/include/catalog/pg_pltemplate.h
@@ -31,8 +31,8 @@
 CATALOG(pg_pltemplate,1136) BKI_SHARED_RELATION BKI_WITHOUT_OIDS
 {
 	NameData	tmplname;		/* name of PL */
-	bool		tmpltrusted;	/* PL is trusted? */
-	bool		tmpldbacreate;	/* PL is installable by db owner? */
+	bool8		tmpltrusted;	/* PL is trusted? */
+	bool8		tmpldbacreate;	/* PL is installable by db owner? */
 
 #ifdef CATALOG_VARLEN			/* variable-length fields start here */
 	text		tmplhandler BKI_FORCE_NOT_NULL; /* name of call handler
diff --git a/src/include/catalog/pg_policy.h b/src/include/catalog/pg_policy.h
index 86000737fa..8aa1f2a4d8 100644
--- a/src/include/catalog/pg_policy.h
+++ b/src/include/catalog/pg_policy.h
@@ -23,7 +23,7 @@ CATALOG(pg_policy,3256)
 	NameData	polname;		/* Policy name. */
 	Oid			polrelid;		/* Oid of the relation with policy. */
 	char		polcmd;			/* One of ACL_*_CHR, or '*' for all */
-	bool		polpermissive;	/* restrictive or permissive policy */
+	bool8		polpermissive;	/* restrictive or permissive policy */
 
 #ifdef CATALOG_VARLEN
 	Oid			polroles[1];	/* Roles associated with policy, not-NULL */
diff --git a/src/include/catalog/pg_proc.h b/src/include/catalog/pg_proc.h
index 830bab37ea..538eea7211 100644
--- a/src/include/catalog/pg_proc.h
+++ b/src/include/catalog/pg_proc.h
@@ -43,12 +43,12 @@ CATALOG(pg_proc,1255) BKI_BOOTSTRAP BKI_ROWTYPE_OID(81) BKI_SCHEMA_MACRO
 	float4		prorows;		/* estimated # of rows out (if proretset) */
 	Oid			provariadic;	/* element type of variadic array, or 0 */
 	regproc		protransform;	/* transforms calls to it during planning */
-	bool		proisagg;		/* is it an aggregate? */
-	bool		proiswindow;	/* is it a window function? */
-	bool		prosecdef;		/* security definer */
-	bool		proleakproof;	/* is it a leak-proof function? */
-	bool		proisstrict;	/* strict with respect to NULLs? */
-	bool		proretset;		/* returns a set? */
+	bool8		proisagg;		/* is it an aggregate? */
+	bool8		proiswindow;	/* is it a window function? */
+	bool8		prosecdef;		/* security definer */
+	bool8		proleakproof;	/* is it a leak-proof function? */
+	bool8		proisstrict;	/* strict with respect to NULLs? */
+	bool8		proretset;		/* returns a set? */
 	char		provolatile;	/* see PROVOLATILE_ categories below */
 	char		proparallel;	/* see PROPARALLEL_ categories below */
 	int16		pronargs;		/* number of arguments */
diff --git a/src/include/catalog/pg_publication.h b/src/include/catalog/pg_publication.h
index aa148960cd..19283ecd2e 100644
--- a/src/include/catalog/pg_publication.h
+++ b/src/include/catalog/pg_publication.h
@@ -38,16 +38,16 @@ CATALOG(pg_publication,6104)
 	 * indicates that this is special publication which should encompass all
 	 * tables in the database (except for the unlogged and temp ones)
 	 */
-	bool		puballtables;
+	bool8		puballtables;
 
 	/* true if inserts are published */
-	bool		pubinsert;
+	bool8		pubinsert;
 
 	/* true if updates are published */
-	bool		pubupdate;
+	bool8		pubupdate;
 
 	/* true if deletes are published */
-	bool		pubdelete;
+	bool8		pubdelete;
 
 } FormData_pg_publication;
 
diff --git a/src/include/catalog/pg_rewrite.h b/src/include/catalog/pg_rewrite.h
index 48b9333a9d..3c71e8e641 100644
--- a/src/include/catalog/pg_rewrite.h
+++ b/src/include/catalog/pg_rewrite.h
@@ -37,7 +37,7 @@ CATALOG(pg_rewrite,2618)
 	Oid			ev_class;
 	char		ev_type;
 	char		ev_enabled;
-	bool		is_instead;
+	bool8		is_instead;
 
 #ifdef CATALOG_VARLEN			/* variable-length fields start here */
 	pg_node_tree ev_qual;
diff --git a/src/include/catalog/pg_sequence.h b/src/include/catalog/pg_sequence.h
index 6de54bb665..9b84e16ed1 100644
--- a/src/include/catalog/pg_sequence.h
+++ b/src/include/catalog/pg_sequence.h
@@ -24,7 +24,7 @@ CATALOG(pg_sequence,2224) BKI_WITHOUT_OIDS
 	int64		seqmax;
 	int64		seqmin;
 	int64		seqcache;
-	bool		seqcycle;
+	bool8		seqcycle;
 } FormData_pg_sequence;
 
 typedef FormData_pg_sequence *Form_pg_sequence;
diff --git a/src/include/catalog/pg_statistic.h b/src/include/catalog/pg_statistic.h
index 43128f1928..1ed6387b03 100644
--- a/src/include/catalog/pg_statistic.h
+++ b/src/include/catalog/pg_statistic.h
@@ -33,7 +33,7 @@ CATALOG(pg_statistic,2619) BKI_WITHOUT_OIDS
 	/* These fields form the unique key for the entry: */
 	Oid			starelid;		/* relation containing attribute */
 	int16		staattnum;		/* attribute (column) stats are for */
-	bool		stainherit;		/* true if inheritance children are included */
+	bool8		stainherit;		/* true if inheritance children are included */
 
 	/* the fraction of the column's entries that are NULL: */
 	float4		stanullfrac;
diff --git a/src/include/catalog/pg_subscription.h b/src/include/catalog/pg_subscription.h
index 274ff6bc42..032b02e4fb 100644
--- a/src/include/catalog/pg_subscription.h
+++ b/src/include/catalog/pg_subscription.h
@@ -37,7 +37,7 @@ CATALOG(pg_subscription,6100) BKI_SHARED_RELATION BKI_ROWTYPE_OID(6101) BKI_SCHE
 
 	Oid			subowner;		/* Owner of the subscription */
 
-	bool		subenabled;		/* True if the subscription is enabled (the
+	bool8		subenabled;		/* True if the subscription is enabled (the
 								 * worker should be running) */
 
 #ifdef CATALOG_VARLEN			/* variable-length fields start here */
diff --git a/src/include/catalog/pg_trigger.h b/src/include/catalog/pg_trigger.h
index f413caf34f..0faa1812ab 100644
--- a/src/include/catalog/pg_trigger.h
+++ b/src/include/catalog/pg_trigger.h
@@ -42,12 +42,12 @@ CATALOG(pg_trigger,2620)
 								 * ROW/STATEMENT; see below */
 	char		tgenabled;		/* trigger's firing configuration WRT
 								 * session_replication_role */
-	bool		tgisinternal;	/* trigger is system-generated */
+	bool8		tgisinternal;	/* trigger is system-generated */
 	Oid			tgconstrrelid;	/* constraint's FROM table, if any */
 	Oid			tgconstrindid;	/* constraint's supporting index, if any */
 	Oid			tgconstraint;	/* associated pg_constraint entry, if any */
-	bool		tgdeferrable;	/* constraint trigger is deferrable */
-	bool		tginitdeferred; /* constraint trigger is deferred initially */
+	bool8		tgdeferrable;	/* constraint trigger is deferrable */
+	bool8		tginitdeferred; /* constraint trigger is deferred initially */
 	int16		tgnargs;		/* # of extra arguments in tgargs */
 
 	/*
diff --git a/src/include/catalog/pg_type.h b/src/include/catalog/pg_type.h
index e3551440a0..a41e664449 100644
--- a/src/include/catalog/pg_type.h
+++ b/src/include/catalog/pg_type.h
@@ -57,7 +57,7 @@ CATALOG(pg_type,1247) BKI_BOOTSTRAP BKI_ROWTYPE_OID(71) BKI_SCHEMA_MACRO
 	 * typbyval can be false even if the length would allow pass-by-value;
 	 * this is currently true for type float4, for example.
 	 */
-	bool		typbyval;
+	bool8		typbyval;
 
 	/*
 	 * typtype is 'b' for a base type, 'c' for a composite type (e.g., a
@@ -76,13 +76,13 @@ CATALOG(pg_type,1247) BKI_BOOTSTRAP BKI_ROWTYPE_OID(71) BKI_SCHEMA_MACRO
 	 */
 	char		typcategory;	/* arbitrary type classification */
 
-	bool		typispreferred; /* is type "preferred" within its category? */
+	bool8		typispreferred; /* is type "preferred" within its category? */
 
 	/*
 	 * If typisdefined is false, the entry is only a placeholder (forward
 	 * reference).  We know the type name, but not yet anything else about it.
 	 */
-	bool		typisdefined;
+	bool8		typisdefined;
 
 	char		typdelim;		/* delimiter for arrays of this type */
 
@@ -172,7 +172,7 @@ CATALOG(pg_type,1247) BKI_BOOTSTRAP BKI_ROWTYPE_OID(71) BKI_SCHEMA_MACRO
 	 *
 	 * Used primarily for domain types.
 	 */
-	bool		typnotnull;
+	bool8		typnotnull;
 
 	/*
 	 * Domains use typbasetype to show the base (or domain) type that the
diff --git a/src/include/commands/sequence.h b/src/include/commands/sequence.h
index caab195130..09ad49e214 100644
--- a/src/include/commands/sequence.h
+++ b/src/include/commands/sequence.h
@@ -26,7 +26,7 @@ typedef struct FormData_pg_sequence_data
 {
 	int64		last_value;
 	int64		log_cnt;
-	bool		is_called;
+	bool8		is_called;
 } FormData_pg_sequence_data;
 
 typedef FormData_pg_sequence_data *Form_pg_sequence_data;

base-commit: f83040c62a78e784e6e33a6382a55925bfd66634
-- 
2.15.1

