pg.ddx.io  pgsql-hackers@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Peter Eisentraut <peter.eisentraut@2ndquadrant.com>
To: pgsql-hackers <pgsql-hackers@postgresql.org>
Subject: taking stdbool.h into use
Date: Wed, 16 Aug 2017 00:36:09 -0400
Message-ID: <3a0fe7e1-5ed1-414b-9230-53bbc0ed1f49@2ndquadrant.com> (raw)
List-Unsubscribe: <mailto:majordomo@postgresql.org?body=unsub%20pgsql-hackers>

Some not so long time ago, it was discussed to look into taking
stdbool.h into use.  The reason was that third-party libraries (perl?,
ldap?, postgis?) are increasingly doing so, and having incompatible
definitions of bool could/does create a mess.

Here is a patch set that aims to accomplish that.  On the way there, it
cleans up various loose and weird uses of bool and proposes a way to
ensure that the system catalog structs get a 1-byte bool even if the
"standard" bool is not.

I have done a fair amount of testing on this, including a hand-rigged
setup where _Bool is not 1 byte.  But obviously, more and wider testing
would be very useful.

-- 
Peter Eisentraut              http://www.2ndQuadrant.com/
PostgreSQL Development, 24x7 Support, Remote DBA, Training & Services
From 34273524912be24a42d2fc0f9c5f24f55052b089 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 1/8] Fix bool/int type confusion

Using ++ on a bool variable doesn't work well when stdbool.h is in use.
The original BSD code appears to use int here, so use that instead.
---
 src/timezone/localtime.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/src/timezone/localtime.c b/src/timezone/localtime.c
index 08642d1236..82c18e8544 100644
--- a/src/timezone/localtime.c
+++ b/src/timezone/localtime.c
@@ -1379,7 +1379,7 @@ timesub(const pg_time_t *timep, int32 offset,
 	int			y;
 	const int  *ip;
 	int64		corr;
-	bool		hit;
+	int			hit;
 	int			i;
 
 	corr = 0;
-- 
2.14.1


From fe86c67cd3f4db3410bea4f72abed1d79f93792d 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 2/8] Change TRUE/FALSE to true/false

The lower case spellings are C and C++ standard and are used in most
parts of the PostgreSQL sources.  The upper case spellings are only used
in some files/modules.  So standardize on the standard spellings.
---
 contrib/btree_gist/btree_bit.c        |   6 +-
 contrib/btree_gist/btree_bytea.c      |   2 +-
 contrib/btree_gist/btree_inet.c       |   2 +-
 contrib/btree_gist/btree_interval.c   |   4 +-
 contrib/btree_gist/btree_numeric.c    |   2 +-
 contrib/btree_gist/btree_text.c       |   4 +-
 contrib/btree_gist/btree_time.c       |   2 +-
 contrib/btree_gist/btree_ts.c         |   2 +-
 contrib/btree_gist/btree_utils_num.c  |   4 +-
 contrib/btree_gist/btree_utils_var.c  |  12 +-
 contrib/btree_gist/btree_uuid.c       |   2 +-
 contrib/cube/cube.c                   |  36 ++---
 contrib/dblink/dblink.c               |   6 +-
 contrib/fuzzystrmatch/fuzzystrmatch.c |   8 +-
 contrib/hstore/hstore_gist.c          |  10 +-
 contrib/intarray/_int_bool.c          |   2 +-
 contrib/intarray/_int_gin.c           |  14 +-
 contrib/intarray/_int_gist.c          |  18 +--
 contrib/intarray/_int_op.c            |   8 +-
 contrib/intarray/_int_tool.c          |   6 +-
 contrib/intarray/_intbig_gist.c       |   6 +-
 contrib/ltree/_ltree_gist.c           |   4 +-
 contrib/ltree/ltree_gist.c            |   4 +-
 contrib/pg_trgm/trgm_gist.c           |   4 +-
 contrib/seg/seg.c                     |  10 +-
 doc/src/sgml/gin.sgml                 |  28 ++--
 doc/src/sgml/indexam.sgml             |  26 +--
 doc/src/sgml/libpq.sgml               |   4 +-
 doc/src/sgml/spgist.sgml              |   2 +-
 doc/src/sgml/sslinfo.sgml             |   6 +-
 src/backend/access/gin/ginbtree.c     |   4 +-
 src/backend/access/gin/ginbulk.c      |   6 +-
 src/backend/access/gin/gindatapage.c  |  14 +-
 src/backend/access/gin/ginentrypage.c |  16 +-
 src/backend/access/gin/ginget.c       |  40 ++---
 src/backend/access/gin/gininsert.c    |   4 +-
 src/backend/access/gin/ginvacuum.c    |  32 ++--
 src/backend/access/gist/gist.c        |   4 +-
 src/backend/access/gist/gistget.c     |   4 +-
 src/backend/access/gist/gistproc.c    |  16 +-
 src/backend/access/gist/gistsplit.c   |  38 ++---
 src/backend/access/gist/gistutil.c    |  24 +--
 src/backend/commands/tablecmds.c      |  14 +-
 src/backend/executor/nodeAgg.c        |   2 +-
 src/backend/executor/nodeAppend.c     |   8 +-
 src/backend/executor/nodeGroup.c      |   8 +-
 src/backend/optimizer/util/predtest.c |  42 ++---
 src/backend/parser/gram.y             | 294 +++++++++++++++++-----------------
 src/backend/parser/parse_utilcmd.c    |   8 +-
 src/backend/replication/repl_gram.y   |  18 +--
 src/backend/storage/buffer/bufmgr.c   |  26 +--
 src/backend/storage/buffer/localbuf.c |   6 +-
 src/backend/storage/ipc/shmem.c       |   8 +-
 src/backend/storage/ipc/shmqueue.c    |   8 +-
 src/backend/storage/lmgr/lock.c       |  26 +--
 src/backend/utils/adt/datetime.c      |  50 +++---
 src/backend/utils/adt/formatting.c    | 272 +++++++++++++++----------------
 src/backend/utils/adt/geo_ops.c       |  12 +-
 src/backend/utils/adt/network_gist.c  |   6 +-
 src/backend/utils/adt/numeric.c       |  10 +-
 src/backend/utils/adt/tsginidx.c      |   2 +-
 src/backend/utils/adt/tsgistidx.c     |   6 +-
 src/backend/utils/adt/tsquery_gist.c  |   4 +-
 src/backend/utils/misc/guc.c          |  18 +--
 src/interfaces/ecpg/preproc/pgc.l     |  24 +--
 src/interfaces/libpq/fe-connect.c     |  28 ++--
 src/interfaces/libpq/fe-exec.c        |  86 +++++-----
 src/interfaces/libpq/fe-misc.c        |   2 +-
 src/interfaces/libpq/fe-protocol2.c   |  12 +-
 src/interfaces/libpq/fe-protocol3.c   |  12 +-
 src/interfaces/libpq/libpq-events.c   |  34 ++--
 src/pl/plpgsql/src/pl_exec.c          |   8 +-
 72 files changed, 750 insertions(+), 750 deletions(-)

diff --git a/contrib/btree_gist/btree_bit.c b/contrib/btree_gist/btree_bit.c
index a56a2752a7..2225244ded 100644
--- a/contrib/btree_gist/btree_bit.c
+++ b/contrib/btree_gist/btree_bit.c
@@ -111,7 +111,7 @@ static const gbtree_vinfo tinfo =
 {
 	gbt_t_bit,
 	0,
-	TRUE,
+	true,
 	gbt_bitgt,
 	gbt_bitge,
 	gbt_biteq,
@@ -152,13 +152,13 @@ gbt_bit_consistent(PG_FUNCTION_ARGS)
 
 	if (GIST_LEAF(entry))
 		retval = gbt_var_consistent(&r, query, strategy, PG_GET_COLLATION(),
-									TRUE, &tinfo, fcinfo->flinfo);
+									true, &tinfo, fcinfo->flinfo);
 	else
 	{
 		bytea	   *q = gbt_bit_xfrm((bytea *) query);
 
 		retval = gbt_var_consistent(&r, q, strategy, PG_GET_COLLATION(),
-									FALSE, &tinfo, fcinfo->flinfo);
+									false, &tinfo, fcinfo->flinfo);
 	}
 	PG_RETURN_BOOL(retval);
 }
diff --git a/contrib/btree_gist/btree_bytea.c b/contrib/btree_gist/btree_bytea.c
index 00753e7f48..6b005f0157 100644
--- a/contrib/btree_gist/btree_bytea.c
+++ b/contrib/btree_gist/btree_bytea.c
@@ -75,7 +75,7 @@ static const gbtree_vinfo tinfo =
 {
 	gbt_t_bytea,
 	0,
-	TRUE,
+	true,
 	gbt_byteagt,
 	gbt_byteage,
 	gbt_byteaeq,
diff --git a/contrib/btree_gist/btree_inet.c b/contrib/btree_gist/btree_inet.c
index b5b593f77f..86c27ca955 100644
--- a/contrib/btree_gist/btree_inet.c
+++ b/contrib/btree_gist/btree_inet.c
@@ -105,7 +105,7 @@ gbt_inet_compress(PG_FUNCTION_ARGS)
 		r->upper = r->lower;
 		gistentryinit(*retval, PointerGetDatum(r),
 					  entry->rel, entry->page,
-					  entry->offset, FALSE);
+					  entry->offset, false);
 	}
 	else
 		retval = entry;
diff --git a/contrib/btree_gist/btree_interval.c b/contrib/btree_gist/btree_interval.c
index 61ab478c42..3a527a75fa 100644
--- a/contrib/btree_gist/btree_interval.c
+++ b/contrib/btree_gist/btree_interval.c
@@ -169,7 +169,7 @@ gbt_intv_compress(PG_FUNCTION_ARGS)
 		}
 		gistentryinit(*retval, PointerGetDatum(r),
 					  entry->rel, entry->page,
-					  entry->offset, FALSE);
+					  entry->offset, false);
 	}
 
 	PG_RETURN_POINTER(retval);
@@ -201,7 +201,7 @@ gbt_intv_decompress(PG_FUNCTION_ARGS)
 
 		gistentryinit(*retval, PointerGetDatum(r),
 					  entry->rel, entry->page,
-					  entry->offset, FALSE);
+					  entry->offset, false);
 	}
 	PG_RETURN_POINTER(retval);
 }
diff --git a/contrib/btree_gist/btree_numeric.c b/contrib/btree_gist/btree_numeric.c
index 43793d36a2..b72060cdb6 100644
--- a/contrib/btree_gist/btree_numeric.c
+++ b/contrib/btree_gist/btree_numeric.c
@@ -79,7 +79,7 @@ static const gbtree_vinfo tinfo =
 {
 	gbt_t_numeric,
 	0,
-	FALSE,
+	false,
 	gbt_numeric_gt,
 	gbt_numeric_ge,
 	gbt_numeric_eq,
diff --git a/contrib/btree_gist/btree_text.c b/contrib/btree_gist/btree_text.c
index 090c849470..79ffac2685 100644
--- a/contrib/btree_gist/btree_text.c
+++ b/contrib/btree_gist/btree_text.c
@@ -80,7 +80,7 @@ static gbtree_vinfo tinfo =
 {
 	gbt_t_text,
 	0,
-	FALSE,
+	false,
 	gbt_textgt,
 	gbt_textge,
 	gbt_texteq,
@@ -128,7 +128,7 @@ gbt_bpchar_compress(PG_FUNCTION_ARGS)
 
 		gistentryinit(trim, d,
 					  entry->rel, entry->page,
-					  entry->offset, TRUE);
+					  entry->offset, true);
 		retval = gbt_var_compress(&trim, &tinfo);
 	}
 	else
diff --git a/contrib/btree_gist/btree_time.c b/contrib/btree_gist/btree_time.c
index bb239d4986..90cf6554ea 100644
--- a/contrib/btree_gist/btree_time.c
+++ b/contrib/btree_gist/btree_time.c
@@ -183,7 +183,7 @@ gbt_timetz_compress(PG_FUNCTION_ARGS)
 		r->lower = r->upper = tmp;
 		gistentryinit(*retval, PointerGetDatum(r),
 					  entry->rel, entry->page,
-					  entry->offset, FALSE);
+					  entry->offset, false);
 	}
 	else
 		retval = entry;
diff --git a/contrib/btree_gist/btree_ts.c b/contrib/btree_gist/btree_ts.c
index 1582cff102..18740cad38 100644
--- a/contrib/btree_gist/btree_ts.c
+++ b/contrib/btree_gist/btree_ts.c
@@ -230,7 +230,7 @@ gbt_tstz_compress(PG_FUNCTION_ARGS)
 		r->lower = r->upper = gmt;
 		gistentryinit(*retval, PointerGetDatum(r),
 					  entry->rel, entry->page,
-					  entry->offset, FALSE);
+					  entry->offset, false);
 	}
 	else
 		retval = entry;
diff --git a/contrib/btree_gist/btree_utils_num.c b/contrib/btree_gist/btree_utils_num.c
index bae32c4064..3b77d22b4b 100644
--- a/contrib/btree_gist/btree_utils_num.c
+++ b/contrib/btree_gist/btree_utils_num.c
@@ -86,7 +86,7 @@ gbt_num_compress(GISTENTRY *entry, const gbtree_ninfo *tinfo)
 		memcpy((void *) &r[tinfo->size], leaf, tinfo->size);
 		retval = palloc(sizeof(GISTENTRY));
 		gistentryinit(*retval, PointerGetDatum(r), entry->rel, entry->page,
-					  entry->offset, FALSE);
+					  entry->offset, false);
 	}
 	else
 		retval = entry;
@@ -150,7 +150,7 @@ gbt_num_fetch(GISTENTRY *entry, const gbtree_ninfo *tinfo)
 
 	retval = palloc(sizeof(GISTENTRY));
 	gistentryinit(*retval, datum, entry->rel, entry->page, entry->offset,
-				  FALSE);
+				  false);
 	return retval;
 }
 
diff --git a/contrib/btree_gist/btree_utils_var.c b/contrib/btree_gist/btree_utils_var.c
index 2c636ad2fa..a7d7597d7a 100644
--- a/contrib/btree_gist/btree_utils_var.c
+++ b/contrib/btree_gist/btree_utils_var.c
@@ -45,7 +45,7 @@ gbt_var_decompress(PG_FUNCTION_ARGS)
 
 		gistentryinit(*retval, PointerGetDatum(key),
 					  entry->rel, entry->page,
-					  entry->offset, FALSE);
+					  entry->offset, false);
 
 		PG_RETURN_POINTER(retval);
 	}
@@ -169,7 +169,7 @@ gbt_var_node_cp_len(const GBT_VARKEY *node, const gbtree_vinfo *tinfo)
 static bool
 gbt_bytea_pf_match(const bytea *pf, const bytea *query, const gbtree_vinfo *tinfo)
 {
-	bool		out = FALSE;
+	bool		out = false;
 	int32		qlen = VARSIZE(query) - VARHDRSZ;
 	int32		nlen = VARSIZE(pf) - VARHDRSZ;
 
@@ -294,7 +294,7 @@ gbt_var_compress(GISTENTRY *entry, const gbtree_vinfo *tinfo)
 		retval = palloc(sizeof(GISTENTRY));
 		gistentryinit(*retval, PointerGetDatum(r),
 					  entry->rel, entry->page,
-					  entry->offset, TRUE);
+					  entry->offset, true);
 	}
 	else
 		retval = entry;
@@ -314,7 +314,7 @@ gbt_var_fetch(PG_FUNCTION_ARGS)
 	retval = palloc(sizeof(GISTENTRY));
 	gistentryinit(*retval, PointerGetDatum(r.lower),
 				  entry->rel, entry->page,
-				  entry->offset, TRUE);
+				  entry->offset, true);
 
 	PG_RETURN_POINTER(retval);
 }
@@ -561,7 +561,7 @@ gbt_var_consistent(GBT_VARKEY_R *key,
 				   const gbtree_vinfo *tinfo,
 				   FmgrInfo *flinfo)
 {
-	bool		retval = FALSE;
+	bool		retval = false;
 
 	switch (strategy)
 	{
@@ -607,7 +607,7 @@ gbt_var_consistent(GBT_VARKEY_R *key,
 					   (*tinfo->f_eq) (query, key->upper, collation, flinfo));
 			break;
 		default:
-			retval = FALSE;
+			retval = false;
 	}
 
 	return retval;
diff --git a/contrib/btree_gist/btree_uuid.c b/contrib/btree_gist/btree_uuid.c
index ecf357d662..bbed16a852 100644
--- a/contrib/btree_gist/btree_uuid.c
+++ b/contrib/btree_gist/btree_uuid.c
@@ -114,7 +114,7 @@ gbt_uuid_compress(PG_FUNCTION_ARGS)
 		memcpy((void *) (r + UUID_LEN), (void *) key, UUID_LEN);
 		gistentryinit(*retval, PointerGetDatum(r),
 					  entry->rel, entry->page,
-					  entry->offset, FALSE);
+					  entry->offset, false);
 	}
 	else
 		retval = entry;
diff --git a/contrib/cube/cube.c b/contrib/cube/cube.c
index 149558c763..6ab3a15bc8 100644
--- a/contrib/cube/cube.c
+++ b/contrib/cube/cube.c
@@ -309,7 +309,7 @@ cube_out(PG_FUNCTION_ARGS)
 /*
 ** The GiST Consistent method for boxes
 ** Should return false if for all data items x below entry,
-** the predicate x op query == FALSE, where op is the oper
+** the predicate x op query == false, where op is the oper
 ** corresponding to strategy in the pg_amop table.
 */
 Datum
@@ -396,7 +396,7 @@ g_cube_decompress(PG_FUNCTION_ARGS)
 
 		gistentryinit(*retval, PointerGetDatum(key),
 					  entry->rel, entry->page,
-					  entry->offset, FALSE);
+					  entry->offset, false);
 		PG_RETURN_POINTER(retval);
 	}
 	PG_RETURN_POINTER(entry);
@@ -589,9 +589,9 @@ g_cube_same(PG_FUNCTION_ARGS)
 	bool	   *result = (bool *) PG_GETARG_POINTER(2);
 
 	if (cube_cmp_v0(b1, b2) == 0)
-		*result = TRUE;
+		*result = true;
 	else
-		*result = FALSE;
+		*result = false;
 
 	PG_RETURN_NDBOX(result);
 }
@@ -623,7 +623,7 @@ g_cube_leaf_consistent(NDBOX *key,
 			retval = (bool) cube_contains_v0(query, key);
 			break;
 		default:
-			retval = FALSE;
+			retval = false;
 	}
 	return (retval);
 }
@@ -650,7 +650,7 @@ g_cube_internal_consistent(NDBOX *key,
 			retval = (bool) cube_overlap_v0(key, query);
 			break;
 		default:
-			retval = FALSE;
+			retval = false;
 	}
 	return (retval);
 }
@@ -1058,7 +1058,7 @@ cube_contains_v0(NDBOX *a, NDBOX *b)
 	int			i;
 
 	if ((a == NULL) || (b == NULL))
-		return (FALSE);
+		return (false);
 
 	if (DIM(a) < DIM(b))
 	{
@@ -1070,9 +1070,9 @@ cube_contains_v0(NDBOX *a, NDBOX *b)
 		for (i = DIM(a); i < DIM(b); i++)
 		{
 			if (LL_COORD(b, i) != 0)
-				return (FALSE);
+				return (false);
 			if (UR_COORD(b, i) != 0)
-				return (FALSE);
+				return (false);
 		}
 	}
 
@@ -1081,13 +1081,13 @@ cube_contains_v0(NDBOX *a, NDBOX *b)
 	{
 		if (Min(LL_COORD(a, i), UR_COORD(a, i)) >
 			Min(LL_COORD(b, i), UR_COORD(b, i)))
-			return (FALSE);
+			return (false);
 		if (Max(LL_COORD(a, i), UR_COORD(a, i)) <
 			Max(LL_COORD(b, i), UR_COORD(b, i)))
-			return (FALSE);
+			return (false);
 	}
 
-	return (TRUE);
+	return (true);
 }
 
 Datum
@@ -1128,7 +1128,7 @@ cube_overlap_v0(NDBOX *a, NDBOX *b)
 	int			i;
 
 	if ((a == NULL) || (b == NULL))
-		return (FALSE);
+		return (false);
 
 	/* swap the box pointers if needed */
 	if (DIM(a) < DIM(b))
@@ -1143,21 +1143,21 @@ cube_overlap_v0(NDBOX *a, NDBOX *b)
 	for (i = 0; i < DIM(b); i++)
 	{
 		if (Min(LL_COORD(a, i), UR_COORD(a, i)) > Max(LL_COORD(b, i), UR_COORD(b, i)))
-			return (FALSE);
+			return (false);
 		if (Max(LL_COORD(a, i), UR_COORD(a, i)) < Min(LL_COORD(b, i), UR_COORD(b, i)))
-			return (FALSE);
+			return (false);
 	}
 
 	/* compare to zero those dimensions in (a) absent in (b) */
 	for (i = DIM(b); i < DIM(a); i++)
 	{
 		if (Min(LL_COORD(a, i), UR_COORD(a, i)) > 0)
-			return (FALSE);
+			return (false);
 		if (Max(LL_COORD(a, i), UR_COORD(a, i)) < 0)
-			return (FALSE);
+			return (false);
 	}
 
-	return (TRUE);
+	return (true);
 }
 
 
diff --git a/contrib/dblink/dblink.c b/contrib/dblink/dblink.c
index 81136b131c..c90717e678 100644
--- a/contrib/dblink/dblink.c
+++ b/contrib/dblink/dblink.c
@@ -243,7 +243,7 @@ dblink_init(void)
 		pconn = (remoteConn *) MemoryContextAlloc(TopMemoryContext, sizeof(remoteConn));
 		pconn->conn = NULL;
 		pconn->openCursorCount = 0;
-		pconn->newXactForCursor = FALSE;
+		pconn->newXactForCursor = false;
 	}
 }
 
@@ -423,7 +423,7 @@ dblink_open(PG_FUNCTION_ARGS)
 		if (PQresultStatus(res) != PGRES_COMMAND_OK)
 			dblink_res_internalerror(conn, res, "begin error");
 		PQclear(res);
-		rconn->newXactForCursor = TRUE;
+		rconn->newXactForCursor = true;
 
 		/*
 		 * Since transaction state was IDLE, we force cursor count to
@@ -523,7 +523,7 @@ dblink_close(PG_FUNCTION_ARGS)
 		/* if count is zero, commit the transaction */
 		if (rconn->openCursorCount == 0)
 		{
-			rconn->newXactForCursor = FALSE;
+			rconn->newXactForCursor = false;
 
 			res = PQexec(conn, "COMMIT");
 			if (PQresultStatus(res) != PGRES_COMMAND_OK)
diff --git a/contrib/fuzzystrmatch/fuzzystrmatch.c b/contrib/fuzzystrmatch/fuzzystrmatch.c
index ce58a6a7fc..25c6ce465c 100644
--- a/contrib/fuzzystrmatch/fuzzystrmatch.c
+++ b/contrib/fuzzystrmatch/fuzzystrmatch.c
@@ -87,7 +87,7 @@ soundex_code(char letter)
 		phoned_word		--	The final phonized word.  (We'll allocate the
 							memory.)
 	Output
-		error	--	A simple error flag, returns TRUE or FALSE
+		error	--	A simple error flag, returns true or false
 
 	NOTES:	ALL non-alpha characters are ignored, this includes whitespace,
 	although non-alpha characters will break up phonemes.
@@ -101,9 +101,9 @@ soundex_code(char letter)
 
 ***************************************************************************/
 
-#define META_ERROR			FALSE
-#define META_SUCCESS		TRUE
-#define META_FAILURE		FALSE
+#define META_ERROR			false
+#define META_SUCCESS		true
+#define META_FAILURE		false
 
 
 /*	I add modifications to the traditional metaphone algorithm that you
diff --git a/contrib/hstore/hstore_gist.c b/contrib/hstore/hstore_gist.c
index f8f5934e40..c8fc1f9d9e 100644
--- a/contrib/hstore/hstore_gist.c
+++ b/contrib/hstore/hstore_gist.c
@@ -144,7 +144,7 @@ ghstore_compress(PG_FUNCTION_ARGS)
 		gistentryinit(*retval, PointerGetDatum(res),
 					  entry->rel, entry->page,
 					  entry->offset,
-					  FALSE);
+					  false);
 	}
 	else if (!ISALLTRUE(DatumGetPointer(entry->key)))
 	{
@@ -166,7 +166,7 @@ ghstore_compress(PG_FUNCTION_ARGS)
 		gistentryinit(*retval, PointerGetDatum(res),
 					  entry->rel, entry->page,
 					  entry->offset,
-					  FALSE);
+					  false);
 	}
 
 	PG_RETURN_POINTER(retval);
@@ -570,7 +570,7 @@ ghstore_consistent(PG_FUNCTION_ARGS)
 				continue;
 			crc = crc32_sz(VARDATA(key_datums[i]), VARSIZE(key_datums[i]) - VARHDRSZ);
 			if (!(GETBIT(sign, HASHVAL(crc))))
-				res = FALSE;
+				res = false;
 		}
 	}
 	else if (strategy == HStoreExistsAnyStrategyNumber)
@@ -585,7 +585,7 @@ ghstore_consistent(PG_FUNCTION_ARGS)
 						  TEXTOID, -1, false, 'i',
 						  &key_datums, &key_nulls, &key_count);
 
-		res = FALSE;
+		res = false;
 
 		for (i = 0; !res && i < key_count; ++i)
 		{
@@ -595,7 +595,7 @@ ghstore_consistent(PG_FUNCTION_ARGS)
 				continue;
 			crc = crc32_sz(VARDATA(key_datums[i]), VARSIZE(key_datums[i]) - VARHDRSZ);
 			if (GETBIT(sign, HASHVAL(crc)))
-				res = TRUE;
+				res = true;
 		}
 	}
 	else
diff --git a/contrib/intarray/_int_bool.c b/contrib/intarray/_int_bool.c
index a18c645606..5856ca1dba 100644
--- a/contrib/intarray/_int_bool.c
+++ b/contrib/intarray/_int_bool.c
@@ -342,7 +342,7 @@ gin_bool_consistent(QUERYTYPE *query, bool *check)
 				j = 0;
 
 	if (query->size <= 0)
-		return FALSE;
+		return false;
 
 	/*
 	 * Set up data for checkcondition_gin.  This must agree with the query
diff --git a/contrib/intarray/_int_gin.c b/contrib/intarray/_int_gin.c
index 73628bea11..7aebfec54b 100644
--- a/contrib/intarray/_int_gin.c
+++ b/contrib/intarray/_int_gin.c
@@ -116,7 +116,7 @@ ginint4_consistent(PG_FUNCTION_ARGS)
 
 	/* Pointer	   *extra_data = (Pointer *) PG_GETARG_POINTER(4); */
 	bool	   *recheck = (bool *) PG_GETARG_POINTER(5);
-	bool		res = FALSE;
+	bool		res = false;
 	int32		i;
 
 	switch (strategy)
@@ -125,25 +125,25 @@ ginint4_consistent(PG_FUNCTION_ARGS)
 			/* result is not lossy */
 			*recheck = false;
 			/* at least one element in check[] is true, so result = true */
-			res = TRUE;
+			res = true;
 			break;
 		case RTContainedByStrategyNumber:
 		case RTOldContainedByStrategyNumber:
 			/* we will need recheck */
 			*recheck = true;
 			/* at least one element in check[] is true, so result = true */
-			res = TRUE;
+			res = true;
 			break;
 		case RTSameStrategyNumber:
 			/* we will need recheck */
 			*recheck = true;
 			/* Must have all elements in check[] true */
-			res = TRUE;
+			res = true;
 			for (i = 0; i < nkeys; i++)
 			{
 				if (!check[i])
 				{
-					res = FALSE;
+					res = false;
 					break;
 				}
 			}
@@ -153,12 +153,12 @@ ginint4_consistent(PG_FUNCTION_ARGS)
 			/* result is not lossy */
 			*recheck = false;
 			/* Must have all elements in check[] true */
-			res = TRUE;
+			res = true;
 			for (i = 0; i < nkeys; i++)
 			{
 				if (!check[i])
 				{
-					res = FALSE;
+					res = false;
 					break;
 				}
 			}
diff --git a/contrib/intarray/_int_gist.c b/contrib/intarray/_int_gist.c
index 79521b29b0..911d18023b 100644
--- a/contrib/intarray/_int_gist.c
+++ b/contrib/intarray/_int_gist.c
@@ -27,7 +27,7 @@ PG_FUNCTION_INFO_V1(g_int_same);
 /*
 ** The GiST Consistent method for _intments
 ** Should return false if for all data items x below entry,
-** the predicate x op query == FALSE, where op is the oper
+** the predicate x op query == false, where op is the oper
 ** corresponding to strategy in the pg_amop table.
 */
 Datum
@@ -89,7 +89,7 @@ g_int_consistent(PG_FUNCTION_ARGS)
 										   query);
 			break;
 		default:
-			retval = FALSE;
+			retval = false;
 	}
 	pfree(query);
 	PG_RETURN_BOOL(retval);
@@ -159,7 +159,7 @@ g_int_compress(PG_FUNCTION_ARGS)
 
 		retval = palloc(sizeof(GISTENTRY));
 		gistentryinit(*retval, PointerGetDatum(r),
-					  entry->rel, entry->page, entry->offset, FALSE);
+					  entry->rel, entry->page, entry->offset, false);
 
 		PG_RETURN_POINTER(retval);
 	}
@@ -206,7 +206,7 @@ g_int_compress(PG_FUNCTION_ARGS)
 		r = resize_intArrayType(r, len);
 		retval = palloc(sizeof(GISTENTRY));
 		gistentryinit(*retval, PointerGetDatum(r),
-					  entry->rel, entry->page, entry->offset, FALSE);
+					  entry->rel, entry->page, entry->offset, false);
 		PG_RETURN_POINTER(retval);
 	}
 	else
@@ -236,7 +236,7 @@ g_int_decompress(PG_FUNCTION_ARGS)
 		{
 			retval = palloc(sizeof(GISTENTRY));
 			gistentryinit(*retval, PointerGetDatum(in),
-						  entry->rel, entry->page, entry->offset, FALSE);
+						  entry->rel, entry->page, entry->offset, false);
 			PG_RETURN_POINTER(retval);
 		}
 
@@ -251,7 +251,7 @@ g_int_decompress(PG_FUNCTION_ARGS)
 		{
 			retval = palloc(sizeof(GISTENTRY));
 			gistentryinit(*retval, PointerGetDatum(in),
-						  entry->rel, entry->page, entry->offset, FALSE);
+						  entry->rel, entry->page, entry->offset, false);
 
 			PG_RETURN_POINTER(retval);
 		}
@@ -273,7 +273,7 @@ g_int_decompress(PG_FUNCTION_ARGS)
 		pfree(in);
 	retval = palloc(sizeof(GISTENTRY));
 	gistentryinit(*retval, PointerGetDatum(r),
-				  entry->rel, entry->page, entry->offset, FALSE);
+				  entry->rel, entry->page, entry->offset, false);
 
 	PG_RETURN_POINTER(retval);
 }
@@ -321,14 +321,14 @@ g_int_same(PG_FUNCTION_ARGS)
 		*result = false;
 		PG_RETURN_POINTER(result);
 	}
-	*result = TRUE;
+	*result = true;
 	da = ARRPTR(a);
 	db = ARRPTR(b);
 	while (n--)
 	{
 		if (*da++ != *db++)
 		{
-			*result = FALSE;
+			*result = false;
 			break;
 		}
 	}
diff --git a/contrib/intarray/_int_op.c b/contrib/intarray/_int_op.c
index 3637c4564c..fe7fcc4662 100644
--- a/contrib/intarray/_int_op.c
+++ b/contrib/intarray/_int_op.c
@@ -74,19 +74,19 @@ _int_same(PG_FUNCTION_ARGS)
 	da = ARRPTR(a);
 	db = ARRPTR(b);
 
-	result = FALSE;
+	result = false;
 
 	if (na == nb)
 	{
 		SORT(a);
 		SORT(b);
-		result = TRUE;
+		result = true;
 
 		for (n = 0; n < na; n++)
 		{
 			if (da[n] != db[n])
 			{
-				result = FALSE;
+				result = false;
 				break;
 			}
 		}
@@ -110,7 +110,7 @@ _int_overlap(PG_FUNCTION_ARGS)
 	CHECKARRVALID(a);
 	CHECKARRVALID(b);
 	if (ARRISEMPTY(a) || ARRISEMPTY(b))
-		return FALSE;
+		return false;
 
 	SORT(a);
 	SORT(b);
diff --git a/contrib/intarray/_int_tool.c b/contrib/intarray/_int_tool.c
index 2fdfd2ec63..ee8fb64a47 100644
--- a/contrib/intarray/_int_tool.c
+++ b/contrib/intarray/_int_tool.c
@@ -40,7 +40,7 @@ inner_int_contains(ArrayType *a, ArrayType *b)
 			break;				/* db[j] is not in da */
 	}
 
-	return (n == nb) ? TRUE : FALSE;
+	return (n == nb) ? true : false;
 }
 
 /* arguments are assumed sorted */
@@ -65,12 +65,12 @@ inner_int_overlap(ArrayType *a, ArrayType *b)
 		if (da[i] < db[j])
 			i++;
 		else if (da[i] == db[j])
-			return TRUE;
+			return true;
 		else
 			j++;
 	}
 
-	return FALSE;
+	return false;
 }
 
 ArrayType *
diff --git a/contrib/intarray/_intbig_gist.c b/contrib/intarray/_intbig_gist.c
index 6dae7c91c1..de7bc82a23 100644
--- a/contrib/intarray/_intbig_gist.c
+++ b/contrib/intarray/_intbig_gist.c
@@ -168,7 +168,7 @@ g_intbig_compress(PG_FUNCTION_ARGS)
 		retval = (GISTENTRY *) palloc(sizeof(GISTENTRY));
 		gistentryinit(*retval, PointerGetDatum(res),
 					  entry->rel, entry->page,
-					  entry->offset, FALSE);
+					  entry->offset, false);
 
 		if (in != DatumGetArrayTypeP(entry->key))
 			pfree(in);
@@ -195,7 +195,7 @@ g_intbig_compress(PG_FUNCTION_ARGS)
 		retval = (GISTENTRY *) palloc(sizeof(GISTENTRY));
 		gistentryinit(*retval, PointerGetDatum(res),
 					  entry->rel, entry->page,
-					  entry->offset, FALSE);
+					  entry->offset, false);
 
 		PG_RETURN_POINTER(retval);
 	}
@@ -594,7 +594,7 @@ g_intbig_consistent(PG_FUNCTION_ARGS)
 				retval = _intbig_overlap((GISTTYPE *) DatumGetPointer(entry->key), query);
 			break;
 		default:
-			retval = FALSE;
+			retval = false;
 	}
 	PG_FREE_IF_COPY(query, 1);
 	PG_RETURN_BOOL(retval);
diff --git a/contrib/ltree/_ltree_gist.c b/contrib/ltree/_ltree_gist.c
index a387f5b899..77efa2fdeb 100644
--- a/contrib/ltree/_ltree_gist.c
+++ b/contrib/ltree/_ltree_gist.c
@@ -100,7 +100,7 @@ _ltree_compress(PG_FUNCTION_ARGS)
 		retval = (GISTENTRY *) palloc(sizeof(GISTENTRY));
 		gistentryinit(*retval, PointerGetDatum(key),
 					  entry->rel, entry->page,
-					  entry->offset, FALSE);
+					  entry->offset, false);
 	}
 	else if (!LTG_ISALLTRUE(entry->key))
 	{
@@ -123,7 +123,7 @@ _ltree_compress(PG_FUNCTION_ARGS)
 		retval = (GISTENTRY *) palloc(sizeof(GISTENTRY));
 		gistentryinit(*retval, PointerGetDatum(key),
 					  entry->rel, entry->page,
-					  entry->offset, FALSE);
+					  entry->offset, false);
 	}
 	PG_RETURN_POINTER(retval);
 }
diff --git a/contrib/ltree/ltree_gist.c b/contrib/ltree/ltree_gist.c
index 70e78a672a..86d50028bb 100644
--- a/contrib/ltree/ltree_gist.c
+++ b/contrib/ltree/ltree_gist.c
@@ -64,7 +64,7 @@ ltree_compress(PG_FUNCTION_ARGS)
 		retval = (GISTENTRY *) palloc(sizeof(GISTENTRY));
 		gistentryinit(*retval, PointerGetDatum(key),
 					  entry->rel, entry->page,
-					  entry->offset, FALSE);
+					  entry->offset, false);
 	}
 	PG_RETURN_POINTER(retval);
 }
@@ -81,7 +81,7 @@ ltree_decompress(PG_FUNCTION_ARGS)
 
 		gistentryinit(*retval, PointerGetDatum(key),
 					  entry->rel, entry->page,
-					  entry->offset, FALSE);
+					  entry->offset, false);
 		PG_RETURN_POINTER(retval);
 	}
 	PG_RETURN_POINTER(entry);
diff --git a/contrib/pg_trgm/trgm_gist.c b/contrib/pg_trgm/trgm_gist.c
index ed02af875c..e55dc19a65 100644
--- a/contrib/pg_trgm/trgm_gist.c
+++ b/contrib/pg_trgm/trgm_gist.c
@@ -106,7 +106,7 @@ gtrgm_compress(PG_FUNCTION_ARGS)
 		retval = (GISTENTRY *) palloc(sizeof(GISTENTRY));
 		gistentryinit(*retval, PointerGetDatum(res),
 					  entry->rel, entry->page,
-					  entry->offset, FALSE);
+					  entry->offset, false);
 	}
 	else if (ISSIGNKEY(DatumGetPointer(entry->key)) &&
 			 !ISALLTRUE(DatumGetPointer(entry->key)))
@@ -130,7 +130,7 @@ gtrgm_compress(PG_FUNCTION_ARGS)
 		retval = (GISTENTRY *) palloc(sizeof(GISTENTRY));
 		gistentryinit(*retval, PointerGetDatum(res),
 					  entry->rel, entry->page,
-					  entry->offset, FALSE);
+					  entry->offset, false);
 	}
 	PG_RETURN_POINTER(retval);
 }
diff --git a/contrib/seg/seg.c b/contrib/seg/seg.c
index 4fc18130e1..7b74fb9d84 100644
--- a/contrib/seg/seg.c
+++ b/contrib/seg/seg.c
@@ -188,7 +188,7 @@ seg_upper(PG_FUNCTION_ARGS)
 /*
 ** The GiST Consistent method for segments
 ** Should return false if for all data items x below entry,
-** the predicate x op query == FALSE, where op is the oper
+** the predicate x op query == false, where op is the oper
 ** corresponding to strategy in the pg_amop table.
 */
 Datum
@@ -413,9 +413,9 @@ gseg_same(PG_FUNCTION_ARGS)
 	bool	   *result = (bool *) PG_GETARG_POINTER(2);
 
 	if (DirectFunctionCall2(seg_same, PG_GETARG_DATUM(0), PG_GETARG_DATUM(1)))
-		*result = TRUE;
+		*result = true;
 	else
-		*result = FALSE;
+		*result = false;
 
 #ifdef GIST_DEBUG
 	fprintf(stderr, "same: %s\n", (*result ? "TRUE" : "FALSE"));
@@ -465,7 +465,7 @@ gseg_leaf_consistent(Datum key, Datum query, StrategyNumber strategy)
 			retval = DirectFunctionCall2(seg_contained, key, query);
 			break;
 		default:
-			retval = FALSE;
+			retval = false;
 	}
 
 	PG_RETURN_DATUM(retval);
@@ -514,7 +514,7 @@ gseg_internal_consistent(Datum key, Datum query, StrategyNumber strategy)
 				DatumGetBool(DirectFunctionCall2(seg_overlap, key, query));
 			break;
 		default:
-			retval = FALSE;
+			retval = false;
 	}
 
 	PG_RETURN_BOOL(retval);
diff --git a/doc/src/sgml/gin.sgml b/doc/src/sgml/gin.sgml
index 7c2321ec3c..f5b5b9386c 100644
--- a/doc/src/sgml/gin.sgml
+++ b/doc/src/sgml/gin.sgml
@@ -223,9 +223,9 @@ <title>Extensibility</title>
       <para>
        <literal>pmatch</> is an output argument for use when partial match
        is supported.  To use it, <function>extractQuery</> must allocate
-       an array of <literal>*nkeys</> booleans and store its address at
-       <literal>*pmatch</>.  Each element of the array should be set to TRUE
-       if the corresponding key requires partial match, FALSE if not.
+       an array of <literal>*nkeys</> bools and store its address at
+       <literal>*pmatch</>.  Each element of the array should be set to true
+       if the corresponding key requires partial match, false if not.
        If <literal>*pmatch</> is set to <symbol>NULL</symbol> then GIN assumes partial match
        is not required.  The variable is initialized to <symbol>NULL</symbol> before call,
        so this argument can simply be ignored by operator classes that do
@@ -267,7 +267,7 @@ <title>Extensibility</title>
         Datum queryKeys[], bool nullFlags[])</></term>
      <listitem>
       <para>
-       Returns TRUE if an indexed item satisfies the query operator with
+       Returns true if an indexed item satisfies the query operator with
        strategy number <literal>n</> (or might satisfy it, if the recheck
        indication is returned).  This function does not have direct access
        to the indexed item's value, since <acronym>GIN</acronym> does not
@@ -277,8 +277,8 @@ <title>Extensibility</title>
        <literal>nkeys</>, which is the same as the number of keys previously
        returned by <function>extractQuery</> for this <literal>query</> datum.
        Each element of the
-       <literal>check</> array is TRUE if the indexed item contains the
-       corresponding query key, i.e., if (check[i] == TRUE) the i-th key of the
+       <literal>check</> array is true if the indexed item contains the
+       corresponding query key, i.e., if (check[i] == true) the i-th key of the
        <function>extractQuery</> result array is present in the indexed item.
        The original <literal>query</> datum is
        passed in case the <function>consistent</> method needs to consult it,
@@ -291,7 +291,7 @@ <title>Extensibility</title>
       <para>
        When <function>extractQuery</> returns a null key in
        <literal>queryKeys[]</>, the corresponding <literal>check[]</> element
-       is TRUE if the indexed item contains a null key; that is, the
+       is true if the indexed item contains a null key; that is, the
        semantics of <literal>check[]</> are like <literal>IS NOT DISTINCT
        FROM</>.  The <function>consistent</> function can examine the
        corresponding <literal>nullFlags[]</> element if it needs to tell
@@ -299,13 +299,13 @@ <title>Extensibility</title>
       </para>
 
       <para>
-       On success, <literal>*recheck</> should be set to TRUE if the heap
-       tuple needs to be rechecked against the query operator, or FALSE if
-       the index test is exact.  That is, a FALSE return value guarantees
-       that the heap tuple does not match the query; a TRUE return value with
-       <literal>*recheck</> set to FALSE guarantees that the heap tuple does
-       match the query; and a TRUE return value with
-       <literal>*recheck</> set to TRUE means that the heap tuple might match
+       On success, <literal>*recheck</> should be set to true if the heap
+       tuple needs to be rechecked against the query operator, or false if
+       the index test is exact.  That is, a false return value guarantees
+       that the heap tuple does not match the query; a true return value with
+       <literal>*recheck</> set to false guarantees that the heap tuple does
+       match the query; and a true return value with
+       <literal>*recheck</> set to true means that the heap tuple might match
        the query, so it needs to be fetched and rechecked by evaluating the
        query operator directly against the originally indexed item.
       </para>
diff --git a/doc/src/sgml/indexam.sgml b/doc/src/sgml/indexam.sgml
index ac512588e2..3e0f05d398 100644
--- a/doc/src/sgml/indexam.sgml
+++ b/doc/src/sgml/indexam.sgml
@@ -280,9 +280,9 @@ <title>Index Access Method Functions</title>
   <para>
    The function's Boolean result value is significant only when
    <literal>checkUnique</> is <literal>UNIQUE_CHECK_PARTIAL</>.
-   In this case a TRUE result means the new entry is known unique, whereas
-   FALSE means it might be non-unique (and a deferred uniqueness check must
-   be scheduled).  For other cases a constant FALSE result is recommended.
+   In this case a true result means the new entry is known unique, whereas
+   false means it might be non-unique (and a deferred uniqueness check must
+   be scheduled).  For other cases a constant false result is recommended.
   </para>
 
   <para>
@@ -368,8 +368,8 @@ <title>Index Access Method Functions</title>
    linkend="indexes-index-only-scans"><firstterm>index-only scans</></link> on
    the given column, by returning the indexed column values for an index entry
    in the form of an <structname>IndexTuple</structname>.  The attribute number
-   is 1-based, i.e. the first column's attno is 1. Returns TRUE if supported,
-   else FALSE.  If the access method does not support index-only scans at all,
+   is 1-based, i.e. the first column's attno is 1. Returns true if supported,
+   else false.  If the access method does not support index-only scans at all,
    the <structfield>amcanreturn</> field in its <structname>IndexAmRoutine</>
    struct can be set to NULL.
   </para>
@@ -532,15 +532,15 @@ <title>Index Access Method Functions</title>
             ScanDirection direction);
 </programlisting>
    Fetch the next tuple in the given scan, moving in the given
-   direction (forward or backward in the index).  Returns TRUE if a tuple was
-   obtained, FALSE if no matching tuples remain.  In the TRUE case the tuple
+   direction (forward or backward in the index).  Returns true if a tuple was
+   obtained, false if no matching tuples remain.  In the true case the tuple
    TID is stored into the <literal>scan</> structure.  Note that
    <quote>success</> means only that the index contains an entry that matches
    the scan keys, not that the tuple necessarily still exists in the heap or
    will pass the caller's snapshot test.  On success, <function>amgettuple</>
-   must also set <literal>scan-&gt;xs_recheck</> to TRUE or FALSE.
-   FALSE means it is certain that the index entry matches the scan keys.
-   TRUE means this is not certain, and the conditions represented by the
+   must also set <literal>scan-&gt;xs_recheck</> to true or false.
+   False means it is certain that the index entry matches the scan keys.
+   true means this is not certain, and the conditions represented by the
    scan keys must be rechecked against the heap tuple after fetching it.
    This provision supports <quote>lossy</> index operators.
    Note that rechecking will extend only to the scan conditions; a partial
@@ -550,7 +550,7 @@ <title>Index Access Method Functions</title>
 
   <para>
    If the index supports <link linkend="indexes-index-only-scans">index-only
-   scans</link> (i.e., <function>amcanreturn</function> returns TRUE for it),
+   scans</link> (i.e., <function>amcanreturn</function> returns true for it),
    then on success the AM must also check <literal>scan-&gt;xs_want_itup</>,
    and if that is true it must return the originally indexed data for the
    index entry.  The data can be returned in the form of an
@@ -1082,8 +1082,8 @@ <title>Index Uniqueness Checks</title>
        constraint is deferrable. <productname>PostgreSQL</productname>
        will use this mode to insert each row's index entry.  The access
        method must allow duplicate entries into the index, and report any
-       potential duplicates by returning FALSE from <function>aminsert</>.
-       For each row for which FALSE is returned, a deferred recheck will
+       potential duplicates by returning false from <function>aminsert</>.
+       For each row for which false is returned, a deferred recheck will
        be scheduled.
       </para>
 
diff --git a/doc/src/sgml/libpq.sgml b/doc/src/sgml/libpq.sgml
index ad5e9b95b4..dad7f53f52 100644
--- a/doc/src/sgml/libpq.sgml
+++ b/doc/src/sgml/libpq.sgml
@@ -6965,12 +6965,12 @@ <title>Event Example</title>
             break;
         }
 
-        /* unknown event ID, just return TRUE. */
+        /* unknown event ID, just return true. */
         default:
             break;
     }
 
-    return TRUE; /* event processing succeeded */
+    return true; /* event processing succeeded */
 }
 ]]>
 </programlisting>
diff --git a/doc/src/sgml/spgist.sgml b/doc/src/sgml/spgist.sgml
index cd4a8d07c4..2842a3c5d9 100644
--- a/doc/src/sgml/spgist.sgml
+++ b/doc/src/sgml/spgist.sgml
@@ -794,7 +794,7 @@ <title>SP-GiST Limits</title>
    trees, in which each level of the tree includes a prefix that is short
    enough to fit on a page, and the final leaf level includes a suffix also
    short enough to fit on a page.  The operator class should set
-   <structfield>longValuesOK</> to TRUE only if it is prepared to arrange for
+   <structfield>longValuesOK</> to true only if it is prepared to arrange for
    this to happen.  Otherwise, the <acronym>SP-GiST</acronym> core will
    reject any request to index a value that is too large to fit
    on an index page.
diff --git a/doc/src/sgml/sslinfo.sgml b/doc/src/sgml/sslinfo.sgml
index 7bda33efa3..ac7bf63a97 100644
--- a/doc/src/sgml/sslinfo.sgml
+++ b/doc/src/sgml/sslinfo.sgml
@@ -32,7 +32,7 @@ <title>Functions Provided</title>
     </term>
     <listitem>
     <para>
-     Returns TRUE if current connection to server uses SSL, and FALSE
+     Returns true if current connection to server uses SSL, and false
      otherwise.
     </para>
     </listitem>
@@ -77,8 +77,8 @@ <title>Functions Provided</title>
     </term>
     <listitem>
     <para>
-     Returns TRUE if current client has presented a valid SSL client
-     certificate to the server, and FALSE otherwise.  (The server
+     Returns true if current client has presented a valid SSL client
+     certificate to the server, and false otherwise.  (The server
      might or might not be configured to require a client certificate.)
     </para>
     </listitem>
diff --git a/src/backend/access/gin/ginbtree.c b/src/backend/access/gin/ginbtree.c
index b02cb8ae58..1b920facc2 100644
--- a/src/backend/access/gin/ginbtree.c
+++ b/src/backend/access/gin/ginbtree.c
@@ -41,7 +41,7 @@ ginTraverseLock(Buffer buffer, bool searchMode)
 	page = BufferGetPage(buffer);
 	if (GinPageIsLeaf(page))
 	{
-		if (searchMode == FALSE)
+		if (searchMode == false)
 		{
 			/* we should relock our page */
 			LockBuffer(buffer, GIN_UNLOCK);
@@ -107,7 +107,7 @@ ginFindLeafPage(GinBtree btree, bool searchMode, Snapshot snapshot)
 		 * ok, page is correctly locked, we should check to move right ..,
 		 * root never has a right link, so small optimization
 		 */
-		while (btree->fullScan == FALSE && stack->blkno != btree->rootBlkno &&
+		while (btree->fullScan == false && stack->blkno != btree->rootBlkno &&
 			   btree->isMoveRight(btree, page))
 		{
 			BlockNumber rightlink = GinPageGetOpaque(page)->rightlink;
diff --git a/src/backend/access/gin/ginbulk.c b/src/backend/access/gin/ginbulk.c
index 4ff149e59a..d5b9e78133 100644
--- a/src/backend/access/gin/ginbulk.c
+++ b/src/backend/access/gin/ginbulk.c
@@ -52,7 +52,7 @@ ginCombineData(RBNode *existing, const RBNode *newdata, void *arg)
 	}
 
 	/* If item pointers are not ordered, they will need to be sorted later */
-	if (eo->shouldSort == FALSE)
+	if (eo->shouldSort == false)
 	{
 		int			res;
 
@@ -60,7 +60,7 @@ ginCombineData(RBNode *existing, const RBNode *newdata, void *arg)
 		Assert(res != 0);
 
 		if (res > 0)
-			eo->shouldSort = TRUE;
+			eo->shouldSort = true;
 	}
 
 	eo->list[eo->count] = en->list[0];
@@ -175,7 +175,7 @@ ginInsertBAEntry(BuildAccumulator *accum,
 			ea->key = getDatumCopy(accum, attnum, key);
 		ea->maxcount = DEF_NPTR;
 		ea->count = 1;
-		ea->shouldSort = FALSE;
+		ea->shouldSort = false;
 		ea->list =
 			(ItemPointerData *) palloc(sizeof(ItemPointerData) * DEF_NPTR);
 		ea->list[0] = *heapptr;
diff --git a/src/backend/access/gin/gindatapage.c b/src/backend/access/gin/gindatapage.c
index 2e5ea47976..9c6cba4825 100644
--- a/src/backend/access/gin/gindatapage.c
+++ b/src/backend/access/gin/gindatapage.c
@@ -235,9 +235,9 @@ dataIsMoveRight(GinBtree btree, Page page)
 	ItemPointer iptr = GinDataPageGetRightBound(page);
 
 	if (GinPageRightMost(page))
-		return FALSE;
+		return false;
 
-	return (ginCompareItemPointers(&btree->itemptr, iptr) > 0) ? TRUE : FALSE;
+	return (ginCompareItemPointers(&btree->itemptr, iptr) > 0) ? true : false;
 }
 
 /*
@@ -1875,9 +1875,9 @@ ginPrepareDataScan(GinBtree btree, Relation index, BlockNumber rootBlkno)
 	btree->fillRoot = ginDataFillRoot;
 	btree->prepareDownlink = dataPrepareDownlink;
 
-	btree->isData = TRUE;
-	btree->fullScan = FALSE;
-	btree->isBuild = FALSE;
+	btree->isData = true;
+	btree->fullScan = false;
+	btree->isBuild = false;
 }
 
 /*
@@ -1919,9 +1919,9 @@ ginScanBeginPostingTree(GinBtree btree, Relation index, BlockNumber rootBlkno,
 
 	ginPrepareDataScan(btree, index, rootBlkno);
 
-	btree->fullScan = TRUE;
+	btree->fullScan = true;
 
-	stack = ginFindLeafPage(btree, TRUE, snapshot);
+	stack = ginFindLeafPage(btree, true, snapshot);
 
 	return stack;
 }
diff --git a/src/backend/access/gin/ginentrypage.c b/src/backend/access/gin/ginentrypage.c
index d5cc70258a..bf7b05107b 100644
--- a/src/backend/access/gin/ginentrypage.c
+++ b/src/backend/access/gin/ginentrypage.c
@@ -30,7 +30,7 @@ static void entrySplitPage(GinBtree btree, Buffer origbuf,
  * Form a tuple for entry tree.
  *
  * If the tuple would be too big to be stored, function throws a suitable
- * error if errorTooBig is TRUE, or returns NULL if errorTooBig is FALSE.
+ * error if errorTooBig is true, or returns NULL if errorTooBig is false.
  *
  * See src/backend/access/gin/README for a description of the index tuple
  * format that is being built here.  We build on the assumption that we
@@ -249,7 +249,7 @@ entryIsMoveRight(GinBtree btree, Page page)
 	GinNullCategory category;
 
 	if (GinPageRightMost(page))
-		return FALSE;
+		return false;
 
 	itup = getRightMostTuple(page);
 	attnum = gintuple_get_attrnum(btree->ginstate, itup);
@@ -258,9 +258,9 @@ entryIsMoveRight(GinBtree btree, Page page)
 	if (ginCompareAttEntries(btree->ginstate,
 							 btree->entryAttnum, btree->entryKey, btree->entryCategory,
 							 attnum, key, category) > 0)
-		return TRUE;
+		return true;
 
-	return FALSE;
+	return false;
 }
 
 /*
@@ -356,7 +356,7 @@ entryLocateLeafEntry(GinBtree btree, GinBtreeStack *stack)
 	if (btree->fullScan)
 	{
 		stack->off = FirstOffsetNumber;
-		return TRUE;
+		return true;
 	}
 
 	low = FirstOffsetNumber;
@@ -762,9 +762,9 @@ ginPrepareEntryScan(GinBtree btree, OffsetNumber attnum,
 	btree->fillRoot = ginEntryFillRoot;
 	btree->prepareDownlink = entryPrepareDownlink;
 
-	btree->isData = FALSE;
-	btree->fullScan = FALSE;
-	btree->isBuild = FALSE;
+	btree->isData = false;
+	btree->fullScan = false;
+	btree->isBuild = false;
 
 	btree->entryAttnum = attnum;
 	btree->entryKey = key;
diff --git a/src/backend/access/gin/ginget.c b/src/backend/access/gin/ginget.c
index 56a5bf47b8..2729297643 100644
--- a/src/backend/access/gin/ginget.c
+++ b/src/backend/access/gin/ginget.c
@@ -311,7 +311,7 @@ startScanEntry(GinState *ginstate, GinScanEntry entry, Snapshot snapshot)
 	entry->nlist = 0;
 	entry->matchBitmap = NULL;
 	entry->matchResult = NULL;
-	entry->reduceResult = FALSE;
+	entry->reduceResult = false;
 	entry->predictNumberResult = 0;
 
 	/*
@@ -324,9 +324,9 @@ startScanEntry(GinState *ginstate, GinScanEntry entry, Snapshot snapshot)
 	stackEntry = ginFindLeafPage(&btreeEntry, true, snapshot);
 	page = BufferGetPage(stackEntry->buffer);
 	/* ginFindLeafPage() will have already checked snapshot age. */
-	needUnlock = TRUE;
+	needUnlock = true;
 
-	entry->isFinished = TRUE;
+	entry->isFinished = true;
 
 	if (entry->isPartialMatch ||
 		entry->queryCategory == GIN_CAT_EMPTY_QUERY)
@@ -363,7 +363,7 @@ startScanEntry(GinState *ginstate, GinScanEntry entry, Snapshot snapshot)
 		if (entry->matchBitmap && !tbm_is_empty(entry->matchBitmap))
 		{
 			entry->matchIterator = tbm_begin_iterate(entry->matchBitmap);
-			entry->isFinished = FALSE;
+			entry->isFinished = false;
 		}
 	}
 	else if (btreeEntry.findItem(&btreeEntry, stackEntry))
@@ -385,7 +385,7 @@ startScanEntry(GinState *ginstate, GinScanEntry entry, Snapshot snapshot)
 			 * root of posting tree.
 			 */
 			LockBuffer(stackEntry->buffer, GIN_UNLOCK);
-			needUnlock = FALSE;
+			needUnlock = false;
 
 			stack = ginScanBeginPostingTree(&entry->btree, ginstate->index,
 											rootPostingTree, snapshot);
@@ -410,7 +410,7 @@ startScanEntry(GinState *ginstate, GinScanEntry entry, Snapshot snapshot)
 
 			LockBuffer(entry->buffer, GIN_UNLOCK);
 			freeGinBtreeStack(stack);
-			entry->isFinished = FALSE;
+			entry->isFinished = false;
 		}
 		else if (GinGetNPosting(itup) > 0)
 		{
@@ -418,7 +418,7 @@ startScanEntry(GinState *ginstate, GinScanEntry entry, Snapshot snapshot)
 									   &entry->nlist);
 			entry->predictNumberResult = entry->nlist;
 
-			entry->isFinished = FALSE;
+			entry->isFinished = false;
 		}
 	}
 
@@ -565,7 +565,7 @@ startScan(IndexScanDesc scan)
 			for (i = 0; i < so->totalentries; i++)
 			{
 				so->entries[i]->predictNumberResult /= so->totalentries;
-				so->entries[i]->reduceResult = TRUE;
+				so->entries[i]->reduceResult = true;
 			}
 		}
 	}
@@ -666,7 +666,7 @@ entryLoadMoreItems(GinState *ginstate, GinScanEntry entry,
 			{
 				UnlockReleaseBuffer(entry->buffer);
 				entry->buffer = InvalidBuffer;
-				entry->isFinished = TRUE;
+				entry->isFinished = true;
 				return;
 			}
 
@@ -728,7 +728,7 @@ entryLoadMoreItems(GinState *ginstate, GinScanEntry entry,
 
 /*
  * Sets entry->curItem to next heap item pointer > advancePast, for one entry
- * of one scan key, or sets entry->isFinished to TRUE if there are no more.
+ * of one scan key, or sets entry->isFinished to true if there are no more.
  *
  * Item pointers are returned in ascending order.
  *
@@ -775,7 +775,7 @@ entryGetItem(GinState *ginstate, GinScanEntry entry,
 					ItemPointerSetInvalid(&entry->curItem);
 					tbm_end_iterate(entry->matchIterator);
 					entry->matchIterator = NULL;
-					entry->isFinished = TRUE;
+					entry->isFinished = true;
 					break;
 				}
 
@@ -835,7 +835,7 @@ entryGetItem(GinState *ginstate, GinScanEntry entry,
 						   entry->matchResult->offsets[entry->offset]);
 			entry->offset++;
 			gotitem = true;
-		} while (!gotitem || (entry->reduceResult == TRUE && dropItem(entry)));
+		} while (!gotitem || (entry->reduceResult == true && dropItem(entry)));
 	}
 	else if (!BufferIsValid(entry->buffer))
 	{
@@ -848,7 +848,7 @@ entryGetItem(GinState *ginstate, GinScanEntry entry,
 			if (entry->offset >= entry->nlist)
 			{
 				ItemPointerSetInvalid(&entry->curItem);
-				entry->isFinished = TRUE;
+				entry->isFinished = true;
 				break;
 			}
 
@@ -876,7 +876,7 @@ entryGetItem(GinState *ginstate, GinScanEntry entry,
 			entry->curItem = entry->list[entry->offset++];
 
 		} while (ginCompareItemPointers(&entry->curItem, &advancePast) <= 0 ||
-				 (entry->reduceResult == TRUE && dropItem(entry)));
+				 (entry->reduceResult == true && dropItem(entry)));
 	}
 }
 
@@ -891,7 +891,7 @@ entryGetItem(GinState *ginstate, GinScanEntry entry,
  * iff recheck is needed for this item pointer (including the case where the
  * item pointer is a lossy page pointer).
  *
- * If all entry streams are exhausted, sets key->isFinished to TRUE.
+ * If all entry streams are exhausted, sets key->isFinished to true.
  *
  * Item pointers must be returned in ascending order.
  *
@@ -963,7 +963,7 @@ keyGetItem(GinState *ginstate, MemoryContext tempCtx, GinScanKey key,
 	if (allFinished)
 	{
 		/* all entries are finished */
-		key->isFinished = TRUE;
+		key->isFinished = true;
 		return;
 	}
 
@@ -1051,7 +1051,7 @@ keyGetItem(GinState *ginstate, MemoryContext tempCtx, GinScanKey key,
 	 * them. We could pass them as MAYBE as well, but if we're using the
 	 * "shim" implementation of a tri-state consistent function (see
 	 * ginlogic.c), it's better to pass as few MAYBEs as possible. So pass
-	 * them as TRUE.
+	 * them as true.
 	 *
 	 * Note that only lossy-page entries pointing to the current item's page
 	 * should trigger this processing; we might have future lossy pages in the
@@ -1064,7 +1064,7 @@ keyGetItem(GinState *ginstate, MemoryContext tempCtx, GinScanKey key,
 	for (i = 0; i < key->nentries; i++)
 	{
 		entry = key->scanEntry[i];
-		if (entry->isFinished == FALSE &&
+		if (entry->isFinished == false &&
 			ginCompareItemPointers(&entry->curItem, &curPageLossy) == 0)
 		{
 			if (i < key->nuserentries)
@@ -1314,7 +1314,7 @@ scanGetItem(IndexScanDesc scan, ItemPointerData advancePast,
 		}
 	}
 
-	return TRUE;
+	return true;
 }
 
 
@@ -1508,7 +1508,7 @@ collectMatchesForHeapRow(IndexScanDesc scan, pendingPosition *pos)
 
 		memset(key->entryRes, GIN_FALSE, key->nentries);
 	}
-	memset(pos->hasMatchKey, FALSE, so->nkeys);
+	memset(pos->hasMatchKey, false, so->nkeys);
 
 	/*
 	 * Outer loop iterates over multiple pending-list pages when a single heap
diff --git a/src/backend/access/gin/gininsert.c b/src/backend/access/gin/gininsert.c
index 5378011f50..8acc2b25b2 100644
--- a/src/backend/access/gin/gininsert.c
+++ b/src/backend/access/gin/gininsert.c
@@ -185,7 +185,7 @@ ginEntryInsert(GinState *ginstate,
 	IndexTuple	itup;
 	Page		page;
 
-	insertdata.isDelete = FALSE;
+	insertdata.isDelete = false;
 
 	/* During index build, count the to-be-inserted entry */
 	if (buildStats)
@@ -221,7 +221,7 @@ ginEntryInsert(GinState *ginstate,
 		itup = addItemPointersToLeafTuple(ginstate, itup,
 										  items, nitem, buildStats);
 
-		insertdata.isDelete = TRUE;
+		insertdata.isDelete = true;
 	}
 	else
 	{
diff --git a/src/backend/access/gin/ginvacuum.c b/src/backend/access/gin/ginvacuum.c
index 31425e9963..a20a99c814 100644
--- a/src/backend/access/gin/ginvacuum.c
+++ b/src/backend/access/gin/ginvacuum.c
@@ -235,7 +235,7 @@ ginScanToDelete(GinVacuumState *gvs, BlockNumber blkno, bool isRoot,
 	DataPageDeleteStack *me;
 	Buffer		buffer;
 	Page		page;
-	bool		meDelete = FALSE;
+	bool		meDelete = false;
 	bool		isempty;
 
 	if (isRoot)
@@ -274,7 +274,7 @@ ginScanToDelete(GinVacuumState *gvs, BlockNumber blkno, bool isRoot,
 		{
 			PostingItem *pitem = GinDataPageGetPostingItem(page, i);
 
-			if (ginScanToDelete(gvs, PostingItemGetBlockNumber(pitem), FALSE, me, i))
+			if (ginScanToDelete(gvs, PostingItemGetBlockNumber(pitem), false, me, i))
 				i--;
 		}
 	}
@@ -291,7 +291,7 @@ ginScanToDelete(GinVacuumState *gvs, BlockNumber blkno, bool isRoot,
 		{
 			Assert(!isRoot);
 			ginDeletePage(gvs, blkno, me->leftBlkno, me->parent->blkno, myoff, me->parent->isRoot);
-			meDelete = TRUE;
+			meDelete = true;
 		}
 	}
 
@@ -319,7 +319,7 @@ ginVacuumPostingTreeLeaves(GinVacuumState *gvs, BlockNumber blkno, bool isRoot)
 {
 	Buffer		buffer;
 	Page		page;
-	bool		hasVoidPage = FALSE;
+	bool		hasVoidPage = false;
 	MemoryContext oldCxt;
 
 	buffer = ReadBufferExtended(gvs->index, MAIN_FORKNUM, blkno,
@@ -339,7 +339,7 @@ ginVacuumPostingTreeLeaves(GinVacuumState *gvs, BlockNumber blkno, bool isRoot)
 
 		/* if root is a leaf page, we don't desire further processing */
 		if (GinDataLeafPageIsEmpty(page))
-			hasVoidPage = TRUE;
+			hasVoidPage = true;
 
 		UnlockReleaseBuffer(buffer);
 
@@ -348,8 +348,8 @@ ginVacuumPostingTreeLeaves(GinVacuumState *gvs, BlockNumber blkno, bool isRoot)
 	else
 	{
 		OffsetNumber i;
-		bool		hasEmptyChild = FALSE;
-		bool		hasNonEmptyChild = FALSE;
+		bool		hasEmptyChild = false;
+		bool		hasNonEmptyChild = false;
 		OffsetNumber maxoff = GinPageGetOpaque(page)->maxoff;
 		BlockNumber *children = palloc(sizeof(BlockNumber) * (maxoff + 1));
 
@@ -369,10 +369,10 @@ ginVacuumPostingTreeLeaves(GinVacuumState *gvs, BlockNumber blkno, bool isRoot)
 
 		for (i = FirstOffsetNumber; i <= maxoff; i++)
 		{
-			if (ginVacuumPostingTreeLeaves(gvs, children[i], FALSE))
-				hasEmptyChild = TRUE;
+			if (ginVacuumPostingTreeLeaves(gvs, children[i], false))
+				hasEmptyChild = true;
 			else
-				hasNonEmptyChild = TRUE;
+				hasNonEmptyChild = true;
 		}
 
 		pfree(children);
@@ -380,12 +380,12 @@ ginVacuumPostingTreeLeaves(GinVacuumState *gvs, BlockNumber blkno, bool isRoot)
 		vacuum_delay_point();
 
 		/*
-		 * All subtree is empty - just return TRUE to indicate that parent
+		 * All subtree is empty - just return true to indicate that parent
 		 * must do a cleanup. Unless we are ROOT an there is way to go upper.
 		 */
 
 		if (hasEmptyChild && !hasNonEmptyChild && !isRoot)
-			return TRUE;
+			return true;
 
 		if (hasEmptyChild)
 		{
@@ -399,9 +399,9 @@ ginVacuumPostingTreeLeaves(GinVacuumState *gvs, BlockNumber blkno, bool isRoot)
 
 			memset(&root, 0, sizeof(DataPageDeleteStack));
 			root.leftBlkno = InvalidBlockNumber;
-			root.isRoot = TRUE;
+			root.isRoot = true;
 
-			ginScanToDelete(gvs, blkno, TRUE, &root, InvalidOffsetNumber);
+			ginScanToDelete(gvs, blkno, true, &root, InvalidOffsetNumber);
 
 			ptr = root.child;
 
@@ -416,14 +416,14 @@ ginVacuumPostingTreeLeaves(GinVacuumState *gvs, BlockNumber blkno, bool isRoot)
 		}
 
 		/* Here we have deleted all empty subtrees */
-		return FALSE;
+		return false;
 	}
 }
 
 static void
 ginVacuumPostingTree(GinVacuumState *gvs, BlockNumber rootBlkno)
 {
-	ginVacuumPostingTreeLeaves(gvs, rootBlkno, TRUE);
+	ginVacuumPostingTreeLeaves(gvs, rootBlkno, true);
 }
 
 /*
diff --git a/src/backend/access/gist/gist.c b/src/backend/access/gist/gist.c
index 565525bbdf..121dc016da 100644
--- a/src/backend/access/gist/gist.c
+++ b/src/backend/access/gist/gist.c
@@ -1364,8 +1364,8 @@ gistSplit(Relation r,
 						IndexTupleSize(itup[0]), GiSTPageSize,
 						RelationGetRelationName(r))));
 
-	memset(v.spl_lisnull, TRUE, sizeof(bool) * giststate->tupdesc->natts);
-	memset(v.spl_risnull, TRUE, sizeof(bool) * giststate->tupdesc->natts);
+	memset(v.spl_lisnull, true, sizeof(bool) * giststate->tupdesc->natts);
+	memset(v.spl_risnull, true, sizeof(bool) * giststate->tupdesc->natts);
 	gistSplitByKey(r, page, itup, len, giststate, &v, 0);
 
 	/* form left and right vector */
diff --git a/src/backend/access/gist/gistget.c b/src/backend/access/gist/gistget.c
index 760ea0c997..bb1dd9e9cc 100644
--- a/src/backend/access/gist/gistget.c
+++ b/src/backend/access/gist/gistget.c
@@ -197,7 +197,7 @@ gistindex_keytest(IndexScanDesc scan,
 
 			gistdentryinit(giststate, key->sk_attno - 1, &de,
 						   datum, r, page, offset,
-						   FALSE, isNull);
+						   false, isNull);
 
 			/*
 			 * Call the Consistent function to evaluate the test.  The
@@ -258,7 +258,7 @@ gistindex_keytest(IndexScanDesc scan,
 
 			gistdentryinit(giststate, key->sk_attno - 1, &de,
 						   datum, r, page, offset,
-						   FALSE, isNull);
+						   false, isNull);
 
 			/*
 			 * Call the Distance function to evaluate the distance.  The
diff --git a/src/backend/access/gist/gistproc.c b/src/backend/access/gist/gistproc.c
index 08990f5a1b..b864053ee3 100644
--- a/src/backend/access/gist/gistproc.c
+++ b/src/backend/access/gist/gistproc.c
@@ -105,7 +105,7 @@ box_penalty(const BOX *original, const BOX *new)
  * The GiST Consistent method for boxes
  *
  * Should return false if for all data items x below entry,
- * the predicate x op query must be FALSE, where op is the oper
+ * the predicate x op query must be false, where op is the oper
  * corresponding to strategy in the pg_amop table.
  */
 Datum
@@ -122,7 +122,7 @@ gist_box_consistent(PG_FUNCTION_ARGS)
 	*recheck = false;
 
 	if (DatumGetBoxP(entry->key) == NULL || query == NULL)
-		PG_RETURN_BOOL(FALSE);
+		PG_RETURN_BOOL(false);
 
 	/*
 	 * if entry is not leaf, use rtree_internal_consistent, else use
@@ -1084,7 +1084,7 @@ gist_poly_compress(PG_FUNCTION_ARGS)
 		retval = (GISTENTRY *) palloc(sizeof(GISTENTRY));
 		gistentryinit(*retval, PointerGetDatum(r),
 					  entry->rel, entry->page,
-					  entry->offset, FALSE);
+					  entry->offset, false);
 	}
 	else
 		retval = entry;
@@ -1109,7 +1109,7 @@ gist_poly_consistent(PG_FUNCTION_ARGS)
 	*recheck = true;
 
 	if (DatumGetBoxP(entry->key) == NULL || query == NULL)
-		PG_RETURN_BOOL(FALSE);
+		PG_RETURN_BOOL(false);
 
 	/*
 	 * Since the operators require recheck anyway, we can just use
@@ -1152,7 +1152,7 @@ gist_circle_compress(PG_FUNCTION_ARGS)
 		retval = (GISTENTRY *) palloc(sizeof(GISTENTRY));
 		gistentryinit(*retval, PointerGetDatum(r),
 					  entry->rel, entry->page,
-					  entry->offset, FALSE);
+					  entry->offset, false);
 	}
 	else
 		retval = entry;
@@ -1178,7 +1178,7 @@ gist_circle_consistent(PG_FUNCTION_ARGS)
 	*recheck = true;
 
 	if (DatumGetBoxP(entry->key) == NULL || query == NULL)
-		PG_RETURN_BOOL(FALSE);
+		PG_RETURN_BOOL(false);
 
 	/*
 	 * Since the operators require recheck anyway, we can just use
@@ -1214,7 +1214,7 @@ gist_point_compress(PG_FUNCTION_ARGS)
 		box->high = box->low = *point;
 
 		gistentryinit(*retval, BoxPGetDatum(box),
-					  entry->rel, entry->page, entry->offset, FALSE);
+					  entry->rel, entry->page, entry->offset, false);
 
 		PG_RETURN_POINTER(retval);
 	}
@@ -1243,7 +1243,7 @@ gist_point_fetch(PG_FUNCTION_ARGS)
 	r->y = in->high.y;
 	gistentryinit(*retval, PointerGetDatum(r),
 				  entry->rel, entry->page,
-				  entry->offset, FALSE);
+				  entry->offset, false);
 
 	PG_RETURN_POINTER(retval);
 }
diff --git a/src/backend/access/gist/gistsplit.c b/src/backend/access/gist/gistsplit.c
index 617f42c317..9efb16dd24 100644
--- a/src/backend/access/gist/gistsplit.c
+++ b/src/backend/access/gist/gistsplit.c
@@ -125,7 +125,7 @@ findDontCares(Relation r, GISTSTATE *giststate, GISTENTRY *valvec,
 	 * check for nulls
 	 */
 	gistentryinit(entry, spl->splitVector.spl_rdatum, r, NULL,
-				  (OffsetNumber) 0, FALSE);
+				  (OffsetNumber) 0, false);
 	for (i = 0; i < spl->splitVector.spl_nleft; i++)
 	{
 		int			j = spl->splitVector.spl_left[i];
@@ -141,7 +141,7 @@ findDontCares(Relation r, GISTSTATE *giststate, GISTENTRY *valvec,
 
 	/* And conversely for the right-side tuples */
 	gistentryinit(entry, spl->splitVector.spl_ldatum, r, NULL,
-				  (OffsetNumber) 0, FALSE);
+				  (OffsetNumber) 0, false);
 	for (i = 0; i < spl->splitVector.spl_nright; i++)
 	{
 		int			j = spl->splitVector.spl_right[i];
@@ -177,7 +177,7 @@ removeDontCares(OffsetNumber *a, int *len, const bool *dontcare)
 	{
 		OffsetNumber ai = a[i];
 
-		if (dontcare[ai] == FALSE)
+		if (dontcare[ai] == false)
 		{
 			/* re-emit item into a[] */
 			*curwpos = ai;
@@ -213,10 +213,10 @@ placeOne(Relation r, GISTSTATE *giststate, GistSplitVector *v,
 					rpenalty;
 		GISTENTRY	entry;
 
-		gistentryinit(entry, v->spl_lattr[attno], r, NULL, 0, FALSE);
+		gistentryinit(entry, v->spl_lattr[attno], r, NULL, 0, false);
 		lpenalty = gistpenalty(giststate, attno, &entry, v->spl_lisnull[attno],
 							   identry + attno, isnull[attno]);
-		gistentryinit(entry, v->spl_rattr[attno], r, NULL, 0, FALSE);
+		gistentryinit(entry, v->spl_rattr[attno], r, NULL, 0, false);
 		rpenalty = gistpenalty(giststate, attno, &entry, v->spl_risnull[attno],
 							   identry + attno, isnull[attno]);
 
@@ -265,10 +265,10 @@ supportSecondarySplit(Relation r, GISTSTATE *giststate, int attno,
 				entrySL,
 				entrySR;
 
-	gistentryinit(entryL, oldL, r, NULL, 0, FALSE);
-	gistentryinit(entryR, oldR, r, NULL, 0, FALSE);
-	gistentryinit(entrySL, sv->spl_ldatum, r, NULL, 0, FALSE);
-	gistentryinit(entrySR, sv->spl_rdatum, r, NULL, 0, FALSE);
+	gistentryinit(entryL, oldL, r, NULL, 0, false);
+	gistentryinit(entryR, oldR, r, NULL, 0, false);
+	gistentryinit(entrySL, sv->spl_ldatum, r, NULL, 0, false);
+	gistentryinit(entrySR, sv->spl_rdatum, r, NULL, 0, false);
 
 	if (sv->spl_ldatum_exists && sv->spl_rdatum_exists)
 	{
@@ -320,8 +320,8 @@ supportSecondarySplit(Relation r, GISTSTATE *giststate, int attno,
 		SWAPVAR(sv->spl_left, sv->spl_right, off);
 		SWAPVAR(sv->spl_nleft, sv->spl_nright, noff);
 		SWAPVAR(sv->spl_ldatum, sv->spl_rdatum, datum);
-		gistentryinit(entrySL, sv->spl_ldatum, r, NULL, 0, FALSE);
-		gistentryinit(entrySR, sv->spl_rdatum, r, NULL, 0, FALSE);
+		gistentryinit(entrySL, sv->spl_ldatum, r, NULL, 0, false);
+		gistentryinit(entrySR, sv->spl_rdatum, r, NULL, 0, false);
 	}
 
 	if (sv->spl_ldatum_exists)
@@ -396,20 +396,20 @@ genericPickSplit(GISTSTATE *giststate, GistEntryVector *entryvec, GIST_SPLITVEC
  * Calls user picksplit method for attno column to split tuples into
  * two vectors.
  *
- * Returns FALSE if split is complete (there are no more index columns, or
+ * Returns false if split is complete (there are no more index columns, or
  * there is no need to consider them because split is optimal already).
  *
- * Returns TRUE and v->spl_dontcare = NULL if the picksplit result is
+ * Returns true and v->spl_dontcare = NULL if the picksplit result is
  * degenerate (all tuples seem to be don't-cares), so we should just
  * disregard this column and split on the next column(s) instead.
  *
- * Returns TRUE and v->spl_dontcare != NULL if there are don't-care tuples
+ * Returns true and v->spl_dontcare != NULL if there are don't-care tuples
  * that could be relocated based on the next column(s).  The don't-care
  * tuples have been removed from the split and must be reinserted by caller.
  * There is at least one non-don't-care tuple on each side of the split,
  * and union keys for all columns are updated to include just those tuples.
  *
- * A TRUE result implies there is at least one more index column.
+ * A true result implies there is at least one more index column.
  */
 static bool
 gistUserPicksplit(Relation r, GistEntryVector *entryvec, int attno, GistSplitVector *v,
@@ -610,7 +610,7 @@ gistSplitHalf(GIST_SPLITVEC *v, int len)
  * attno: column we are working on (zero-based index)
  *
  * Outside caller must initialize v->spl_lisnull and v->spl_risnull arrays
- * to all-TRUE.  On return, spl_left/spl_nleft contain indexes of tuples
+ * to all-true.  On return, spl_left/spl_nleft contain indexes of tuples
  * to go left, spl_right/spl_nright contain indexes of tuples to go right,
  * spl_lattr/spl_lisnull contain left-side union key values, and
  * spl_rattr/spl_risnull contain right-side union key values.  Other fields
@@ -643,7 +643,7 @@ gistSplitByKey(Relation r, Page page, IndexTuple *itup, int len,
 							  &IsNull);
 		gistdentryinit(giststate, attno, &(entryvec->vector[i]),
 					   datum, r, page, i,
-					   FALSE, IsNull);
+					   false, IsNull);
 		if (IsNull)
 			offNullTuples[nOffNullTuples++] = i;
 	}
@@ -655,7 +655,7 @@ gistSplitByKey(Relation r, Page page, IndexTuple *itup, int len,
 		 * our attention to the next column.  If there's no next column, just
 		 * split page in half.
 		 */
-		v->spl_risnull[attno] = v->spl_lisnull[attno] = TRUE;
+		v->spl_risnull[attno] = v->spl_lisnull[attno] = true;
 
 		if (attno + 1 < giststate->tupdesc->natts)
 			gistSplitByKey(r, page, itup, len, giststate, v, attno + 1);
@@ -672,7 +672,7 @@ gistSplitByKey(Relation r, Page page, IndexTuple *itup, int len,
 		 */
 		v->splitVector.spl_right = offNullTuples;
 		v->splitVector.spl_nright = nOffNullTuples;
-		v->spl_risnull[attno] = TRUE;
+		v->spl_risnull[attno] = true;
 
 		v->splitVector.spl_left = (OffsetNumber *) palloc(len * sizeof(OffsetNumber));
 		v->splitVector.spl_nleft = 0;
diff --git a/src/backend/access/gist/gistutil.c b/src/backend/access/gist/gistutil.c
index b6ccc1a66a..c7e9b2b1b6 100644
--- a/src/backend/access/gist/gistutil.c
+++ b/src/backend/access/gist/gistutil.c
@@ -179,7 +179,7 @@ gistMakeUnionItVec(GISTSTATE *giststate, IndexTuple *itvec, int len,
 						   evec->vector + evec->n,
 						   datum,
 						   NULL, NULL, (OffsetNumber) 0,
-						   FALSE, IsNull);
+						   false, IsNull);
 			evec->n++;
 		}
 
@@ -187,7 +187,7 @@ gistMakeUnionItVec(GISTSTATE *giststate, IndexTuple *itvec, int len,
 		if (evec->n == 0)
 		{
 			attr[i] = (Datum) 0;
-			isnull[i] = TRUE;
+			isnull[i] = true;
 		}
 		else
 		{
@@ -204,7 +204,7 @@ gistMakeUnionItVec(GISTSTATE *giststate, IndexTuple *itvec, int len,
 										PointerGetDatum(evec),
 										PointerGetDatum(&attrsize));
 
-			isnull[i] = FALSE;
+			isnull[i] = false;
 		}
 	}
 }
@@ -246,17 +246,17 @@ gistMakeUnionKey(GISTSTATE *giststate, int attno,
 
 	if (isnull1 && isnull2)
 	{
-		*dstisnull = TRUE;
+		*dstisnull = true;
 		*dst = (Datum) 0;
 	}
 	else
 	{
-		if (isnull1 == FALSE && isnull2 == FALSE)
+		if (isnull1 == false && isnull2 == false)
 		{
 			evec->vector[0] = *entry1;
 			evec->vector[1] = *entry2;
 		}
-		else if (isnull1 == FALSE)
+		else if (isnull1 == false)
 		{
 			evec->vector[0] = *entry1;
 			evec->vector[1] = *entry1;
@@ -267,7 +267,7 @@ gistMakeUnionKey(GISTSTATE *giststate, int attno,
 			evec->vector[1] = *entry2;
 		}
 
-		*dstisnull = FALSE;
+		*dstisnull = false;
 		*dst = FunctionCall2Coll(&giststate->unionFn[attno],
 								 giststate->supportCollation[attno],
 								 PointerGetDatum(evec),
@@ -303,7 +303,7 @@ gistDeCompressAtt(GISTSTATE *giststate, Relation r, IndexTuple tuple, Page p,
 		datum = index_getattr(tuple, i + 1, giststate->tupdesc, &isnull[i]);
 		gistdentryinit(giststate, i, &attdata[i],
 					   datum, r, p, o,
-					   FALSE, isnull[i]);
+					   false, isnull[i]);
 	}
 }
 
@@ -313,7 +313,7 @@ gistDeCompressAtt(GISTSTATE *giststate, Relation r, IndexTuple tuple, Page p,
 IndexTuple
 gistgetadjusted(Relation r, IndexTuple oldtup, IndexTuple addtup, GISTSTATE *giststate)
 {
-	bool		neednew = FALSE;
+	bool		neednew = false;
 	GISTENTRY	oldentries[INDEX_MAX_KEYS],
 				addentries[INDEX_MAX_KEYS];
 	bool		oldisnull[INDEX_MAX_KEYS],
@@ -451,7 +451,7 @@ gistchoose(Relation r, Page p, IndexTuple it,	/* it has compressed entry */
 			/* Compute penalty for this column. */
 			datum = index_getattr(itup, j + 1, giststate->tupdesc, &IsNull);
 			gistdentryinit(giststate, j, &entry, datum, r, p, i,
-						   FALSE, IsNull);
+						   false, IsNull);
 			usize = gistpenalty(giststate, j, &entry, IsNull,
 								&identry[j], isnull[j]);
 			if (usize > 0)
@@ -671,8 +671,8 @@ gistpenalty(GISTSTATE *giststate, int attno,
 {
 	float		penalty = 0.0;
 
-	if (giststate->penaltyFn[attno].fn_strict == FALSE ||
-		(isNullOrig == FALSE && isNullAdd == FALSE))
+	if (giststate->penaltyFn[attno].fn_strict == false ||
+		(isNullOrig == false && isNullAdd == false))
 	{
 		FunctionCall3Coll(&giststate->penaltyFn[attno],
 						  giststate->supportCollation[attno],
diff --git a/src/backend/commands/tablecmds.c b/src/backend/commands/tablecmds.c
index 513a9ec485..06ae69a003 100644
--- a/src/backend/commands/tablecmds.c
+++ b/src/backend/commands/tablecmds.c
@@ -2254,7 +2254,7 @@ MergeAttributes(List *schema, List *supers, char relpersistence,
  *
  * constraints is a list of CookedConstraint structs for previous constraints.
  *
- * Returns TRUE if merged (constraint is a duplicate), or FALSE if it's
+ * Returns true if merged (constraint is a duplicate), or false if it's
  * got a so-far-unique name, or throws error if conflict.
  */
 static bool
@@ -5701,7 +5701,7 @@ ATExecDropNotNull(Relation rel, const char *colName, LOCKMODE lockmode)
 	 */
 	if (((Form_pg_attribute) GETSTRUCT(tuple))->attnotnull)
 	{
-		((Form_pg_attribute) GETSTRUCT(tuple))->attnotnull = FALSE;
+		((Form_pg_attribute) GETSTRUCT(tuple))->attnotnull = false;
 
 		CatalogTupleUpdate(attr_rel, &tuple->t_self, tuple);
 
@@ -5782,7 +5782,7 @@ ATExecSetNotNull(AlteredTableInfo *tab, Relation rel,
 	 */
 	if (!((Form_pg_attribute) GETSTRUCT(tuple))->attnotnull)
 	{
-		((Form_pg_attribute) GETSTRUCT(tuple))->attnotnull = TRUE;
+		((Form_pg_attribute) GETSTRUCT(tuple))->attnotnull = true;
 
 		CatalogTupleUpdate(attr_rel, &tuple->t_self, tuple);
 
@@ -8202,16 +8202,16 @@ validateForeignKeyConstraint(char *conname,
 	trig.tgoid = InvalidOid;
 	trig.tgname = conname;
 	trig.tgenabled = TRIGGER_FIRES_ON_ORIGIN;
-	trig.tgisinternal = TRUE;
+	trig.tgisinternal = true;
 	trig.tgconstrrelid = RelationGetRelid(pkrel);
 	trig.tgconstrindid = pkindOid;
 	trig.tgconstraint = constraintOid;
-	trig.tgdeferrable = FALSE;
-	trig.tginitdeferred = FALSE;
+	trig.tgdeferrable = false;
+	trig.tginitdeferred = false;
 	/* we needn't fill in remaining fields */
 
 	/*
-	 * See if we can do it with a single LEFT JOIN query.  A FALSE result
+	 * See if we can do it with a single LEFT JOIN query.  A false result
 	 * indicates we must proceed with the fire-the-trigger method.
 	 */
 	if (RI_Initial_Check(&trig, rel, pkrel))
diff --git a/src/backend/executor/nodeAgg.c b/src/backend/executor/nodeAgg.c
index 6a26773a49..7e21b93503 100644
--- a/src/backend/executor/nodeAgg.c
+++ b/src/backend/executor/nodeAgg.c
@@ -2597,7 +2597,7 @@ agg_retrieve_hash_table(AggState *aggstate)
 			else
 			{
 				/* No more hashtables, so done */
-				aggstate->agg_done = TRUE;
+				aggstate->agg_done = true;
 				return NULL;
 			}
 		}
diff --git a/src/backend/executor/nodeAppend.c b/src/backend/executor/nodeAppend.c
index bed9bb8713..1d2fb35d55 100644
--- a/src/backend/executor/nodeAppend.c
+++ b/src/backend/executor/nodeAppend.c
@@ -88,10 +88,10 @@ exec_append_initialize_next(AppendState *appendstate)
 		/*
 		 * if scanning in reverse, we start at the last scan in the list and
 		 * then proceed back to the first.. in any case we inform ExecAppend
-		 * that we are at the end of the line by returning FALSE
+		 * that we are at the end of the line by returning false
 		 */
 		appendstate->as_whichplan = 0;
-		return FALSE;
+		return false;
 	}
 	else if (whichplan >= appendstate->as_nplans)
 	{
@@ -99,11 +99,11 @@ exec_append_initialize_next(AppendState *appendstate)
 		 * as above, end the scan if we go beyond the last scan in our list..
 		 */
 		appendstate->as_whichplan = appendstate->as_nplans - 1;
-		return FALSE;
+		return false;
 	}
 	else
 	{
-		return TRUE;
+		return true;
 	}
 }
 
diff --git a/src/backend/executor/nodeGroup.c b/src/backend/executor/nodeGroup.c
index ab4ae24a6b..6b68835ca1 100644
--- a/src/backend/executor/nodeGroup.c
+++ b/src/backend/executor/nodeGroup.c
@@ -73,7 +73,7 @@ ExecGroup(PlanState *pstate)
 		if (TupIsNull(outerslot))
 		{
 			/* empty input, so return nothing */
-			node->grp_done = TRUE;
+			node->grp_done = true;
 			return NULL;
 		}
 		/* Copy tuple into firsttupleslot */
@@ -116,7 +116,7 @@ ExecGroup(PlanState *pstate)
 			if (TupIsNull(outerslot))
 			{
 				/* no more groups, so we're done */
-				node->grp_done = TRUE;
+				node->grp_done = true;
 				return NULL;
 			}
 
@@ -177,7 +177,7 @@ ExecInitGroup(Group *node, EState *estate, int eflags)
 	grpstate->ss.ps.plan = (Plan *) node;
 	grpstate->ss.ps.state = estate;
 	grpstate->ss.ps.ExecProcNode = ExecGroup;
-	grpstate->grp_done = FALSE;
+	grpstate->grp_done = false;
 
 	/*
 	 * create expression context
@@ -246,7 +246,7 @@ ExecReScanGroup(GroupState *node)
 {
 	PlanState  *outerPlan = outerPlanState(node);
 
-	node->grp_done = FALSE;
+	node->grp_done = false;
 	/* must clear first tuple */
 	ExecClearTuple(node->ss.ss_ScanTupleSlot);
 
diff --git a/src/backend/optimizer/util/predtest.c b/src/backend/optimizer/util/predtest.c
index 536d24b698..4f44e0413c 100644
--- a/src/backend/optimizer/util/predtest.c
+++ b/src/backend/optimizer/util/predtest.c
@@ -174,10 +174,10 @@ predicate_implied_by(List *predicate_list, List *clause_list,
  * in the technique and structure of the code.
  *
  * An important fine point is that truth of the clauses must imply that
- * the predicate returns FALSE, not that it does not return TRUE.  This
+ * the predicate returns false, not that it does not return true.  This
  * is normally used to try to refute CHECK constraints, and the only
  * thing we can assume about a CHECK constraint is that it didn't return
- * FALSE --- a NULL result isn't a violation per the SQL spec.  (Someday
+ * false --- a NULL result isn't a violation per the SQL spec.  (Someday
  * perhaps this code should be extended to support both "strong" and
  * "weak" refutation, but for now we only need "strong".)
  *
@@ -489,7 +489,7 @@ predicate_implied_by_recurse(Node *clause, Node *predicate,
  * In addition, if the predicate is a NOT-clause then we can use
  *	A R=> NOT B if:					A => B
  * This works for several different SQL constructs that assert the non-truth
- * of their argument, ie NOT, IS FALSE, IS NOT TRUE, IS UNKNOWN.
+ * of their argument, ie NOT, IS false, IS NOT true, IS UNKNOWN.
  * Unfortunately we *cannot* use
  *	NOT A R=> B if:					B => A
  * because this type of reasoning fails to prove that B doesn't yield NULL.
@@ -692,7 +692,7 @@ predicate_refuted_by_recurse(Node *clause, Node *predicate,
 			 * If A is a strong NOT-clause, A R=> B if B equals A's arg
 			 *
 			 * We cannot make the stronger conclusion that B is refuted if B
-			 * implies A's arg; that would only prove that B is not-TRUE, not
+			 * implies A's arg; that would only prove that B is not-true, not
 			 * that it's not NULL either.  Hence use equal() rather than
 			 * predicate_implied_by_recurse().  We could do the latter if we
 			 * ever had a need for the weak form of refutation.
@@ -1048,7 +1048,7 @@ arrayexpr_cleanup_fn(PredIterInfo info)
  *	  Does the predicate implication test for a "simple clause" predicate
  *	  and a "simple clause" restriction.
  *
- * We return TRUE if able to prove the implication, FALSE if not.
+ * We return true if able to prove the implication, false if not.
  *
  * We have three strategies for determining whether one simple clause
  * implies another:
@@ -1063,7 +1063,7 @@ arrayexpr_cleanup_fn(PredIterInfo info)
  * NOT NULL", we can conclude that the predicate is implied if the clause is
  * a strict operator or function that has "foo" as an input.  In this case
  * the clause must yield NULL when "foo" is NULL, which we can take as
- * equivalent to FALSE given the context. (Again, "foo" is already known
+ * equivalent to false given the context. (Again, "foo" is already known
  * immutable, so the clause will certainly always fail.) Also, if the clause
  * is just "foo" (meaning it's a boolean variable), the predicate is implied
  * since the clause can't be true if "foo" is NULL.
@@ -1116,7 +1116,7 @@ predicate_implied_by_simple_clause(Expr *predicate, Node *clause,
  *	  Does the predicate refutation test for a "simple clause" predicate
  *	  and a "simple clause" restriction.
  *
- * We return TRUE if able to prove the refutation, FALSE if not.
+ * We return true if able to prove the refutation, false if not.
  *
  * Unlike the implication case, checking for equal() clauses isn't
  * helpful.
@@ -1360,12 +1360,12 @@ static const bool BT_implies_table[6][6] = {
  *			The predicate operator:
  *	 LT    LE	 EQ    GE	 GT    NE
  */
-	{TRUE, TRUE, none, none, none, TRUE},	/* LT */
-	{none, TRUE, none, none, none, none},	/* LE */
-	{none, TRUE, TRUE, TRUE, none, none},	/* EQ */
-	{none, none, none, TRUE, none, none},	/* GE */
-	{none, none, none, TRUE, TRUE, TRUE},	/* GT */
-	{none, none, none, none, none, TRUE}	/* NE */
+	{true, true, none, none, none, true},	/* LT */
+	{none, true, none, none, none, none},	/* LE */
+	{none, true, true, true, none, none},	/* EQ */
+	{none, none, none, true, none, none},	/* GE */
+	{none, none, none, true, true, true},	/* GT */
+	{none, none, none, none, none, true}	/* NE */
 };
 
 static const bool BT_refutes_table[6][6] = {
@@ -1373,12 +1373,12 @@ static const bool BT_refutes_table[6][6] = {
  *			The predicate operator:
  *	 LT    LE	 EQ    GE	 GT    NE
  */
-	{none, none, TRUE, TRUE, TRUE, none},	/* LT */
-	{none, none, none, none, TRUE, none},	/* LE */
-	{TRUE, none, none, none, TRUE, TRUE},	/* EQ */
-	{TRUE, none, none, none, none, none},	/* GE */
-	{TRUE, TRUE, TRUE, none, none, none},	/* GT */
-	{none, none, TRUE, none, none, none}	/* NE */
+	{none, none, true, true, true, none},	/* LT */
+	{none, none, none, none, true, none},	/* LE */
+	{true, none, none, none, true, true},	/* EQ */
+	{true, none, none, none, none, none},	/* GE */
+	{true, true, true, none, none, none},	/* GT */
+	{none, none, true, none, none, none}	/* NE */
 };
 
 static const StrategyNumber BT_implic_table[6][6] = {
@@ -1417,7 +1417,7 @@ static const StrategyNumber BT_refute_table[6][6] = {
  * When refute_it == false, we want to prove the predicate true;
  * when refute_it == true, we want to prove the predicate false.
  * (There is enough common code to justify handling these two cases
- * in one routine.)  We return TRUE if able to make the proof, FALSE
+ * in one routine.)  We return true if able to make the proof, false
  * if not able to prove it.
  *
  * We can make proofs involving several expression forms (here "foo" and "bar"
@@ -1661,7 +1661,7 @@ operator_predicate_proof(Expr *predicate, Node *clause, bool refute_it)
  *	  Assuming that EXPR1 clause_op EXPR2 is true, try to prove or refute
  *	  EXPR1 pred_op EXPR2.
  *
- * Return TRUE if able to make the proof, false if not able to prove it.
+ * Return true if able to make the proof, false if not able to prove it.
  */
 static bool
 operator_same_subexprs_proof(Oid pred_op, Oid clause_op, bool refute_it)
diff --git a/src/backend/parser/gram.y b/src/backend/parser/gram.y
index 7d0de99baf..ec5ce78827 100644
--- a/src/backend/parser/gram.y
+++ b/src/backend/parser/gram.y
@@ -1005,7 +1005,7 @@ AlterOptRoleElem:
 				}
 			| INHERIT
 				{
-					$$ = makeDefElem("inherit", (Node *)makeInteger(TRUE), @1);
+					$$ = makeDefElem("inherit", (Node *)makeInteger(true), @1);
 				}
 			| CONNECTION LIMIT SignedIconst
 				{
@@ -1028,36 +1028,36 @@ AlterOptRoleElem:
 					 * size of the main parser.
 					 */
 					if (strcmp($1, "superuser") == 0)
-						$$ = makeDefElem("superuser", (Node *)makeInteger(TRUE), @1);
+						$$ = makeDefElem("superuser", (Node *)makeInteger(true), @1);
 					else if (strcmp($1, "nosuperuser") == 0)
-						$$ = makeDefElem("superuser", (Node *)makeInteger(FALSE), @1);
+						$$ = makeDefElem("superuser", (Node *)makeInteger(false), @1);
 					else if (strcmp($1, "createrole") == 0)
-						$$ = makeDefElem("createrole", (Node *)makeInteger(TRUE), @1);
+						$$ = makeDefElem("createrole", (Node *)makeInteger(true), @1);
 					else if (strcmp($1, "nocreaterole") == 0)
-						$$ = makeDefElem("createrole", (Node *)makeInteger(FALSE), @1);
+						$$ = makeDefElem("createrole", (Node *)makeInteger(false), @1);
 					else if (strcmp($1, "replication") == 0)
-						$$ = makeDefElem("isreplication", (Node *)makeInteger(TRUE), @1);
+						$$ = makeDefElem("isreplication", (Node *)makeInteger(true), @1);
 					else if (strcmp($1, "noreplication") == 0)
-						$$ = makeDefElem("isreplication", (Node *)makeInteger(FALSE), @1);
+						$$ = makeDefElem("isreplication", (Node *)makeInteger(false), @1);
 					else if (strcmp($1, "createdb") == 0)
-						$$ = makeDefElem("createdb", (Node *)makeInteger(TRUE), @1);
+						$$ = makeDefElem("createdb", (Node *)makeInteger(true), @1);
 					else if (strcmp($1, "nocreatedb") == 0)
-						$$ = makeDefElem("createdb", (Node *)makeInteger(FALSE), @1);
+						$$ = makeDefElem("createdb", (Node *)makeInteger(false), @1);
 					else if (strcmp($1, "login") == 0)
-						$$ = makeDefElem("canlogin", (Node *)makeInteger(TRUE), @1);
+						$$ = makeDefElem("canlogin", (Node *)makeInteger(true), @1);
 					else if (strcmp($1, "nologin") == 0)
-						$$ = makeDefElem("canlogin", (Node *)makeInteger(FALSE), @1);
+						$$ = makeDefElem("canlogin", (Node *)makeInteger(false), @1);
 					else if (strcmp($1, "bypassrls") == 0)
-						$$ = makeDefElem("bypassrls", (Node *)makeInteger(TRUE), @1);
+						$$ = makeDefElem("bypassrls", (Node *)makeInteger(true), @1);
 					else if (strcmp($1, "nobypassrls") == 0)
-						$$ = makeDefElem("bypassrls", (Node *)makeInteger(FALSE), @1);
+						$$ = makeDefElem("bypassrls", (Node *)makeInteger(false), @1);
 					else if (strcmp($1, "noinherit") == 0)
 					{
 						/*
 						 * Note that INHERIT is a keyword, so it's handled by main parser, but
 						 * NOINHERIT is handled here.
 						 */
-						$$ = makeDefElem("inherit", (Node *)makeInteger(FALSE), @1);
+						$$ = makeDefElem("inherit", (Node *)makeInteger(false), @1);
 					}
 					else
 						ereport(ERROR,
@@ -1190,21 +1190,21 @@ DropRoleStmt:
 			DROP ROLE role_list
 				{
 					DropRoleStmt *n = makeNode(DropRoleStmt);
-					n->missing_ok = FALSE;
+					n->missing_ok = false;
 					n->roles = $3;
 					$$ = (Node *)n;
 				}
 			| DROP ROLE IF_P EXISTS role_list
 				{
 					DropRoleStmt *n = makeNode(DropRoleStmt);
-					n->missing_ok = TRUE;
+					n->missing_ok = true;
 					n->roles = $5;
 					$$ = (Node *)n;
 				}
 			| DROP USER role_list
 				{
 					DropRoleStmt *n = makeNode(DropRoleStmt);
-					n->missing_ok = FALSE;
+					n->missing_ok = false;
 					n->roles = $3;
 					$$ = (Node *)n;
 				}
@@ -1212,20 +1212,20 @@ DropRoleStmt:
 				{
 					DropRoleStmt *n = makeNode(DropRoleStmt);
 					n->roles = $5;
-					n->missing_ok = TRUE;
+					n->missing_ok = true;
 					$$ = (Node *)n;
 				}
 			| DROP GROUP_P role_list
 				{
 					DropRoleStmt *n = makeNode(DropRoleStmt);
-					n->missing_ok = FALSE;
+					n->missing_ok = false;
 					n->roles = $3;
 					$$ = (Node *)n;
 				}
 			| DROP GROUP_P IF_P EXISTS role_list
 				{
 					DropRoleStmt *n = makeNode(DropRoleStmt);
-					n->missing_ok = TRUE;
+					n->missing_ok = true;
 					n->roles = $5;
 					$$ = (Node *)n;
 				}
@@ -1730,8 +1730,8 @@ constraints_set_list:
 		;
 
 constraints_set_mode:
-			DEFERRED								{ $$ = TRUE; }
-			| IMMEDIATE								{ $$ = FALSE; }
+			DEFERRED								{ $$ = true; }
+			| IMMEDIATE								{ $$ = false; }
 		;
 
 
@@ -2156,7 +2156,7 @@ alter_table_cmd:
 					n->subtype = AT_DropColumn;
 					n->name = $5;
 					n->behavior = $6;
-					n->missing_ok = TRUE;
+					n->missing_ok = true;
 					$$ = (Node *)n;
 				}
 			/* ALTER TABLE <name> DROP [COLUMN] <colname> [RESTRICT|CASCADE] */
@@ -2166,7 +2166,7 @@ alter_table_cmd:
 					n->subtype = AT_DropColumn;
 					n->name = $3;
 					n->behavior = $4;
-					n->missing_ok = FALSE;
+					n->missing_ok = false;
 					$$ = (Node *)n;
 				}
 			/*
@@ -2234,7 +2234,7 @@ alter_table_cmd:
 					n->subtype = AT_DropConstraint;
 					n->name = $5;
 					n->behavior = $6;
-					n->missing_ok = TRUE;
+					n->missing_ok = true;
 					$$ = (Node *)n;
 				}
 			/* ALTER TABLE <name> DROP CONSTRAINT <name> [RESTRICT|CASCADE] */
@@ -2244,7 +2244,7 @@ alter_table_cmd:
 					n->subtype = AT_DropConstraint;
 					n->name = $3;
 					n->behavior = $4;
-					n->missing_ok = FALSE;
+					n->missing_ok = false;
 					$$ = (Node *)n;
 				}
 			/* ALTER TABLE <name> SET WITH OIDS  */
@@ -2739,7 +2739,7 @@ alter_type_cmd:
 					n->subtype = AT_DropColumn;
 					n->name = $5;
 					n->behavior = $6;
-					n->missing_ok = TRUE;
+					n->missing_ok = true;
 					$$ = (Node *)n;
 				}
 			/* ALTER TYPE <name> DROP ATTRIBUTE <attname> [RESTRICT|CASCADE] */
@@ -2749,7 +2749,7 @@ alter_type_cmd:
 					n->subtype = AT_DropColumn;
 					n->name = $3;
 					n->behavior = $4;
-					n->missing_ok = FALSE;
+					n->missing_ok = false;
 					$$ = (Node *)n;
 				}
 			/* ALTER TYPE <name> ALTER ATTRIBUTE <attname> [SET DATA] TYPE <typename> [RESTRICT|CASCADE] */
@@ -2869,13 +2869,13 @@ CopyStmt:	COPY opt_binary qualified_name opt_column_list opt_oids
 		;
 
 copy_from:
-			FROM									{ $$ = TRUE; }
-			| TO									{ $$ = FALSE; }
+			FROM									{ $$ = true; }
+			| TO									{ $$ = false; }
 		;
 
 opt_program:
-			PROGRAM									{ $$ = TRUE; }
-			| /* EMPTY */							{ $$ = FALSE; }
+			PROGRAM									{ $$ = true; }
+			| /* EMPTY */							{ $$ = false; }
 		;
 
 /*
@@ -2906,11 +2906,11 @@ copy_opt_item:
 				}
 			| OIDS
 				{
-					$$ = makeDefElem("oids", (Node *)makeInteger(TRUE), @1);
+					$$ = makeDefElem("oids", (Node *)makeInteger(true), @1);
 				}
 			| FREEZE
 				{
-					$$ = makeDefElem("freeze", (Node *)makeInteger(TRUE), @1);
+					$$ = makeDefElem("freeze", (Node *)makeInteger(true), @1);
 				}
 			| DELIMITER opt_as Sconst
 				{
@@ -2926,7 +2926,7 @@ copy_opt_item:
 				}
 			| HEADER_P
 				{
-					$$ = makeDefElem("header", (Node *)makeInteger(TRUE), @1);
+					$$ = makeDefElem("header", (Node *)makeInteger(true), @1);
 				}
 			| QUOTE opt_as Sconst
 				{
@@ -2971,7 +2971,7 @@ opt_binary:
 opt_oids:
 			WITH OIDS
 				{
-					$$ = makeDefElem("oids", (Node *)makeInteger(TRUE), @1);
+					$$ = makeDefElem("oids", (Node *)makeInteger(true), @1);
 				}
 			| /*EMPTY*/								{ $$ = NULL; }
 		;
@@ -3625,8 +3625,8 @@ ConstraintElem:
 				}
 		;
 
-opt_no_inherit:	NO INHERIT							{  $$ = TRUE; }
-			| /* EMPTY */							{  $$ = FALSE; }
+opt_no_inherit:	NO INHERIT							{  $$ = true; }
+			| /* EMPTY */							{  $$ = false; }
 		;
 
 opt_column_list:
@@ -3903,9 +3903,9 @@ create_as_target:
 		;
 
 opt_with_data:
-			WITH DATA_P								{ $$ = TRUE; }
-			| WITH NO DATA_P						{ $$ = FALSE; }
-			| /*EMPTY*/								{ $$ = TRUE; }
+			WITH DATA_P								{ $$ = true; }
+			| WITH NO DATA_P						{ $$ = false; }
+			| /*EMPTY*/								{ $$ = true; }
 		;
 
 
@@ -4056,11 +4056,11 @@ SeqOptElem: AS SimpleTypename
 				}
 			| CYCLE
 				{
-					$$ = makeDefElem("cycle", (Node *)makeInteger(TRUE), @1);
+					$$ = makeDefElem("cycle", (Node *)makeInteger(true), @1);
 				}
 			| NO CYCLE
 				{
-					$$ = makeDefElem("cycle", (Node *)makeInteger(FALSE), @1);
+					$$ = makeDefElem("cycle", (Node *)makeInteger(false), @1);
 				}
 			| INCREMENT opt_by NumericOnly
 				{
@@ -4160,8 +4160,8 @@ CreatePLangStmt:
 		;
 
 opt_trusted:
-			TRUSTED									{ $$ = TRUE; }
-			| /*EMPTY*/								{ $$ = FALSE; }
+			TRUSTED									{ $$ = true; }
+			| /*EMPTY*/								{ $$ = false; }
 		;
 
 /* This ought to be just func_name, but that causes reduce/reduce conflicts
@@ -4312,7 +4312,7 @@ create_extension_opt_item:
 				}
 			| CASCADE
 				{
-					$$ = makeDefElem("cascade", (Node *)makeInteger(TRUE), @1);
+					$$ = makeDefElem("cascade", (Node *)makeInteger(true), @1);
 				}
 		;
 
@@ -5176,9 +5176,9 @@ CreateTrigStmt:
 					n->columns = (List *) lsecond($5);
 					n->whenClause = $10;
 					n->transitionRels = $8;
-					n->isconstraint  = FALSE;
-					n->deferrable	 = FALSE;
-					n->initdeferred  = FALSE;
+					n->isconstraint  = false;
+					n->deferrable	 = false;
+					n->initdeferred  = false;
 					n->constrrel = NULL;
 					$$ = (Node *)n;
 				}
@@ -5192,13 +5192,13 @@ CreateTrigStmt:
 					n->relation = $8;
 					n->funcname = $17;
 					n->args = $19;
-					n->row = TRUE;
+					n->row = true;
 					n->timing = TRIGGER_TYPE_AFTER;
 					n->events = intVal(linitial($6));
 					n->columns = (List *) lsecond($6);
 					n->whenClause = $14;
 					n->transitionRels = NIL;
-					n->isconstraint  = TRUE;
+					n->isconstraint  = true;
 					processCASbits($10, @10, "TRIGGER",
 								   &n->deferrable, &n->initdeferred, NULL,
 								   NULL, yyscanner);
@@ -5272,12 +5272,12 @@ TriggerTransition:
 		;
 
 TransitionOldOrNew:
-			NEW										{ $$ = TRUE; }
-			| OLD									{ $$ = FALSE; }
+			NEW										{ $$ = true; }
+			| OLD									{ $$ = false; }
 		;
 
 TransitionRowOrTable:
-			TABLE									{ $$ = TRUE; }
+			TABLE									{ $$ = true; }
 			/*
 			 * According to the standard, lack of a keyword here implies ROW.
 			 * Support for that would require prohibiting ROW entirely here,
@@ -5286,7 +5286,7 @@ TransitionRowOrTable:
 			 * next token.  Requiring ROW seems cleanest and easiest to
 			 * explain.
 			 */
-			| ROW									{ $$ = FALSE; }
+			| ROW									{ $$ = false; }
 		;
 
 TransitionRelName:
@@ -5304,7 +5304,7 @@ TriggerForSpec:
 					 * If ROW/STATEMENT not specified, default to
 					 * STATEMENT, per SQL
 					 */
-					$$ = FALSE;
+					$$ = false;
 				}
 		;
 
@@ -5314,8 +5314,8 @@ TriggerForOptEach:
 		;
 
 TriggerForType:
-			ROW										{ $$ = TRUE; }
-			| STATEMENT								{ $$ = FALSE; }
+			ROW										{ $$ = true; }
+			| STATEMENT								{ $$ = false; }
 		;
 
 TriggerWhen:
@@ -5466,7 +5466,7 @@ CreateAssertStmt:
 					CreateTrigStmt *n = makeNode(CreateTrigStmt);
 					n->trigname = $3;
 					n->args = list_make1($6);
-					n->isconstraint  = TRUE;
+					n->isconstraint  = true;
 					processCASbits($8, @8, "ASSERTION",
 								   &n->deferrable, &n->initdeferred, NULL,
 								   NULL, yyscanner);
@@ -5846,8 +5846,8 @@ opclass_item:
 				}
 		;
 
-opt_default:	DEFAULT						{ $$ = TRUE; }
-			| /*EMPTY*/						{ $$ = FALSE; }
+opt_default:	DEFAULT						{ $$ = true; }
+			| /*EMPTY*/						{ $$ = false; }
 		;
 
 opt_opfamily:	FAMILY any_name				{ $$ = $2; }
@@ -5871,9 +5871,9 @@ opt_recheck:	RECHECK
 							 errmsg("RECHECK is no longer required"),
 							 errhint("Update your data type."),
 							 parser_errposition(@1)));
-					$$ = TRUE;
+					$$ = true;
 				}
-			| /*EMPTY*/						{ $$ = FALSE; }
+			| /*EMPTY*/						{ $$ = false; }
 		;
 
 
@@ -6021,7 +6021,7 @@ DropStmt:	DROP drop_type_any_name IF_P EXISTS any_name_list opt_drop_behavior
 				{
 					DropStmt *n = makeNode(DropStmt);
 					n->removeType = $2;
-					n->missing_ok = TRUE;
+					n->missing_ok = true;
 					n->objects = $5;
 					n->behavior = $6;
 					n->concurrent = false;
@@ -6031,7 +6031,7 @@ DropStmt:	DROP drop_type_any_name IF_P EXISTS any_name_list opt_drop_behavior
 				{
 					DropStmt *n = makeNode(DropStmt);
 					n->removeType = $2;
-					n->missing_ok = FALSE;
+					n->missing_ok = false;
 					n->objects = $3;
 					n->behavior = $4;
 					n->concurrent = false;
@@ -6041,7 +6041,7 @@ DropStmt:	DROP drop_type_any_name IF_P EXISTS any_name_list opt_drop_behavior
 				{
 					DropStmt *n = makeNode(DropStmt);
 					n->removeType = $2;
-					n->missing_ok = TRUE;
+					n->missing_ok = true;
 					n->objects = $5;
 					n->behavior = $6;
 					n->concurrent = false;
@@ -6051,7 +6051,7 @@ DropStmt:	DROP drop_type_any_name IF_P EXISTS any_name_list opt_drop_behavior
 				{
 					DropStmt *n = makeNode(DropStmt);
 					n->removeType = $2;
-					n->missing_ok = FALSE;
+					n->missing_ok = false;
 					n->objects = $3;
 					n->behavior = $4;
 					n->concurrent = false;
@@ -6081,7 +6081,7 @@ DropStmt:	DROP drop_type_any_name IF_P EXISTS any_name_list opt_drop_behavior
 				{
 					DropStmt *n = makeNode(DropStmt);
 					n->removeType = OBJECT_TYPE;
-					n->missing_ok = FALSE;
+					n->missing_ok = false;
 					n->objects = $3;
 					n->behavior = $4;
 					n->concurrent = false;
@@ -6091,7 +6091,7 @@ DropStmt:	DROP drop_type_any_name IF_P EXISTS any_name_list opt_drop_behavior
 				{
 					DropStmt *n = makeNode(DropStmt);
 					n->removeType = OBJECT_TYPE;
-					n->missing_ok = TRUE;
+					n->missing_ok = true;
 					n->objects = $5;
 					n->behavior = $6;
 					n->concurrent = false;
@@ -6101,7 +6101,7 @@ DropStmt:	DROP drop_type_any_name IF_P EXISTS any_name_list opt_drop_behavior
 				{
 					DropStmt *n = makeNode(DropStmt);
 					n->removeType = OBJECT_DOMAIN;
-					n->missing_ok = FALSE;
+					n->missing_ok = false;
 					n->objects = $3;
 					n->behavior = $4;
 					n->concurrent = false;
@@ -6111,7 +6111,7 @@ DropStmt:	DROP drop_type_any_name IF_P EXISTS any_name_list opt_drop_behavior
 				{
 					DropStmt *n = makeNode(DropStmt);
 					n->removeType = OBJECT_DOMAIN;
-					n->missing_ok = TRUE;
+					n->missing_ok = true;
 					n->objects = $5;
 					n->behavior = $6;
 					n->concurrent = false;
@@ -6121,7 +6121,7 @@ DropStmt:	DROP drop_type_any_name IF_P EXISTS any_name_list opt_drop_behavior
 				{
 					DropStmt *n = makeNode(DropStmt);
 					n->removeType = OBJECT_INDEX;
-					n->missing_ok = FALSE;
+					n->missing_ok = false;
 					n->objects = $4;
 					n->behavior = $5;
 					n->concurrent = true;
@@ -6131,7 +6131,7 @@ DropStmt:	DROP drop_type_any_name IF_P EXISTS any_name_list opt_drop_behavior
 				{
 					DropStmt *n = makeNode(DropStmt);
 					n->removeType = OBJECT_INDEX;
-					n->missing_ok = TRUE;
+					n->missing_ok = true;
 					n->objects = $6;
 					n->behavior = $7;
 					n->concurrent = true;
@@ -6553,13 +6553,13 @@ security_label:	Sconst				{ $$ = $1; }
 FetchStmt:	FETCH fetch_args
 				{
 					FetchStmt *n = (FetchStmt *) $2;
-					n->ismove = FALSE;
+					n->ismove = false;
 					$$ = (Node *)n;
 				}
 			| MOVE fetch_args
 				{
 					FetchStmt *n = (FetchStmt *) $2;
-					n->ismove = TRUE;
+					n->ismove = true;
 					$$ = (Node *)n;
 				}
 		;
@@ -6969,8 +6969,8 @@ grantee:
 
 
 opt_grant_grant_option:
-			WITH GRANT OPTION { $$ = TRUE; }
-			| /*EMPTY*/ { $$ = FALSE; }
+			WITH GRANT OPTION { $$ = true; }
+			| /*EMPTY*/ { $$ = false; }
 		;
 
 /*****************************************************************************
@@ -7015,8 +7015,8 @@ RevokeRoleStmt:
 				}
 		;
 
-opt_grant_admin_option: WITH ADMIN OPTION				{ $$ = TRUE; }
-			| /*EMPTY*/									{ $$ = FALSE; }
+opt_grant_admin_option: WITH ADMIN OPTION				{ $$ = true; }
+			| /*EMPTY*/									{ $$ = false; }
 		;
 
 opt_granted_by: GRANTED BY RoleSpec						{ $$ = $3; }
@@ -7179,13 +7179,13 @@ IndexStmt:	CREATE opt_unique INDEX opt_concurrently opt_index_name
 		;
 
 opt_unique:
-			UNIQUE									{ $$ = TRUE; }
-			| /*EMPTY*/								{ $$ = FALSE; }
+			UNIQUE									{ $$ = true; }
+			| /*EMPTY*/								{ $$ = false; }
 		;
 
 opt_concurrently:
-			CONCURRENTLY							{ $$ = TRUE; }
-			| /*EMPTY*/								{ $$ = FALSE; }
+			CONCURRENTLY							{ $$ = true; }
+			| /*EMPTY*/								{ $$ = false; }
 		;
 
 opt_index_name:
@@ -7313,8 +7313,8 @@ CreateFunctionStmt:
 		;
 
 opt_or_replace:
-			OR REPLACE								{ $$ = TRUE; }
-			| /*EMPTY*/								{ $$ = FALSE; }
+			OR REPLACE								{ $$ = true; }
+			| /*EMPTY*/								{ $$ = false; }
 		;
 
 func_args:	'(' func_args_list ')'					{ $$ = $2; }
@@ -7483,7 +7483,7 @@ func_type:	Typename								{ $$ = $1; }
 				{
 					$$ = makeTypeNameFromNameList(lcons(makeString($2), $3));
 					$$->pct_type = true;
-					$$->setof = TRUE;
+					$$->setof = true;
 					$$->location = @2;
 				}
 		;
@@ -7599,15 +7599,15 @@ createfunc_opt_list:
 common_func_opt_item:
 			CALLED ON NULL_P INPUT_P
 				{
-					$$ = makeDefElem("strict", (Node *)makeInteger(FALSE), @1);
+					$$ = makeDefElem("strict", (Node *)makeInteger(false), @1);
 				}
 			| RETURNS NULL_P ON NULL_P INPUT_P
 				{
-					$$ = makeDefElem("strict", (Node *)makeInteger(TRUE), @1);
+					$$ = makeDefElem("strict", (Node *)makeInteger(true), @1);
 				}
 			| STRICT_P
 				{
-					$$ = makeDefElem("strict", (Node *)makeInteger(TRUE), @1);
+					$$ = makeDefElem("strict", (Node *)makeInteger(true), @1);
 				}
 			| IMMUTABLE
 				{
@@ -7623,27 +7623,27 @@ common_func_opt_item:
 				}
 			| EXTERNAL SECURITY DEFINER
 				{
-					$$ = makeDefElem("security", (Node *)makeInteger(TRUE), @1);
+					$$ = makeDefElem("security", (Node *)makeInteger(true), @1);
 				}
 			| EXTERNAL SECURITY INVOKER
 				{
-					$$ = makeDefElem("security", (Node *)makeInteger(FALSE), @1);
+					$$ = makeDefElem("security", (Node *)makeInteger(false), @1);
 				}
 			| SECURITY DEFINER
 				{
-					$$ = makeDefElem("security", (Node *)makeInteger(TRUE), @1);
+					$$ = makeDefElem("security", (Node *)makeInteger(true), @1);
 				}
 			| SECURITY INVOKER
 				{
-					$$ = makeDefElem("security", (Node *)makeInteger(FALSE), @1);
+					$$ = makeDefElem("security", (Node *)makeInteger(false), @1);
 				}
 			| LEAKPROOF
 				{
-					$$ = makeDefElem("leakproof", (Node *)makeInteger(TRUE), @1);
+					$$ = makeDefElem("leakproof", (Node *)makeInteger(true), @1);
 				}
 			| NOT LEAKPROOF
 				{
-					$$ = makeDefElem("leakproof", (Node *)makeInteger(FALSE), @1);
+					$$ = makeDefElem("leakproof", (Node *)makeInteger(false), @1);
 				}
 			| COST NumericOnly
 				{
@@ -7679,7 +7679,7 @@ createfunc_opt_item:
 				}
 			| WINDOW
 				{
-					$$ = makeDefElem("window", (Node *)makeInteger(TRUE), @1);
+					$$ = makeDefElem("window", (Node *)makeInteger(true), @1);
 				}
 			| common_func_opt_item
 				{
@@ -7968,8 +7968,8 @@ DropCastStmt: DROP CAST opt_if_exists '(' Typename AS Typename ')' opt_drop_beha
 				}
 		;
 
-opt_if_exists: IF_P EXISTS						{ $$ = TRUE; }
-		| /*EMPTY*/								{ $$ = FALSE; }
+opt_if_exists: IF_P EXISTS						{ $$ = true; }
+		| /*EMPTY*/								{ $$ = false; }
 		;
 
 
@@ -8097,7 +8097,7 @@ AlterTblSpcStmt:
 						makeNode(AlterTableSpaceOptionsStmt);
 					n->tablespacename = $3;
 					n->options = $5;
-					n->isReset = FALSE;
+					n->isReset = false;
 					$$ = (Node *)n;
 				}
 			| ALTER TABLESPACE name RESET reloptions
@@ -8106,7 +8106,7 @@ AlterTblSpcStmt:
 						makeNode(AlterTableSpaceOptionsStmt);
 					n->tablespacename = $3;
 					n->options = $5;
-					n->isReset = TRUE;
+					n->isReset = true;
 					$$ = (Node *)n;
 				}
 		;
@@ -9133,7 +9133,7 @@ CreatePublicationStmt:
 							n->tables = (List *)$4;
 						/* FOR ALL TABLES */
 						else
-							n->for_all_tables = TRUE;
+							n->for_all_tables = true;
 					}
 					$$ = (Node *)n;
 				}
@@ -9151,7 +9151,7 @@ publication_for_tables:
 				}
 			| FOR ALL TABLES
 				{
-					$$ = (Node *) makeInteger(TRUE);
+					$$ = (Node *) makeInteger(true);
 				}
 		;
 
@@ -9286,7 +9286,7 @@ AlterSubscriptionStmt:
 					n->kind = ALTER_SUBSCRIPTION_ENABLED;
 					n->subname = $3;
 					n->options = list_make1(makeDefElem("enabled",
-											(Node *)makeInteger(TRUE), @1));
+											(Node *)makeInteger(true), @1));
 					$$ = (Node *)n;
 				}
 			| ALTER SUBSCRIPTION name DISABLE_P
@@ -9296,7 +9296,7 @@ AlterSubscriptionStmt:
 					n->kind = ALTER_SUBSCRIPTION_ENABLED;
 					n->subname = $3;
 					n->options = list_make1(makeDefElem("enabled",
-											(Node *)makeInteger(FALSE), @1));
+											(Node *)makeInteger(false), @1));
 					$$ = (Node *)n;
 				}
 		;
@@ -9389,9 +9389,9 @@ event:		SELECT									{ $$ = CMD_SELECT; }
 		 ;
 
 opt_instead:
-			INSTEAD									{ $$ = TRUE; }
-			| ALSO									{ $$ = FALSE; }
-			| /*EMPTY*/								{ $$ = FALSE; }
+			INSTEAD									{ $$ = true; }
+			| ALSO									{ $$ = false; }
+			| /*EMPTY*/								{ $$ = false; }
 		;
 
 
@@ -9567,16 +9567,16 @@ transaction_mode_item:
 									   makeStringConst($3, @3), @1); }
 			| READ ONLY
 					{ $$ = makeDefElem("transaction_read_only",
-									   makeIntConst(TRUE, @1), @1); }
+									   makeIntConst(true, @1), @1); }
 			| READ WRITE
 					{ $$ = makeDefElem("transaction_read_only",
-									   makeIntConst(FALSE, @1), @1); }
+									   makeIntConst(false, @1), @1); }
 			| DEFERRABLE
 					{ $$ = makeDefElem("transaction_deferrable",
-									   makeIntConst(TRUE, @1), @1); }
+									   makeIntConst(true, @1), @1); }
 			| NOT DEFERRABLE
 					{ $$ = makeDefElem("transaction_deferrable",
-									   makeIntConst(FALSE, @1), @1); }
+									   makeIntConst(false, @1), @1); }
 		;
 
 /* Syntax with commas is SQL-spec, without commas is Postgres historical */
@@ -9815,14 +9815,14 @@ DropdbStmt: DROP DATABASE database_name
 				{
 					DropdbStmt *n = makeNode(DropdbStmt);
 					n->dbname = $3;
-					n->missing_ok = FALSE;
+					n->missing_ok = false;
 					$$ = (Node *)n;
 				}
 			| DROP DATABASE IF_P EXISTS database_name
 				{
 					DropdbStmt *n = makeNode(DropdbStmt);
 					n->dbname = $5;
-					n->missing_ok = TRUE;
+					n->missing_ok = true;
 					$$ = (Node *)n;
 				}
 		;
@@ -10229,16 +10229,16 @@ analyze_keyword:
 		;
 
 opt_verbose:
-			VERBOSE									{ $$ = TRUE; }
-			| /*EMPTY*/								{ $$ = FALSE; }
+			VERBOSE									{ $$ = true; }
+			| /*EMPTY*/								{ $$ = false; }
 		;
 
-opt_full:	FULL									{ $$ = TRUE; }
-			| /*EMPTY*/								{ $$ = FALSE; }
+opt_full:	FULL									{ $$ = true; }
+			| /*EMPTY*/								{ $$ = false; }
 		;
 
-opt_freeze: FREEZE									{ $$ = TRUE; }
-			| /*EMPTY*/								{ $$ = FALSE; }
+opt_freeze: FREEZE									{ $$ = true; }
+			| /*EMPTY*/								{ $$ = false; }
 		;
 
 opt_name_list:
@@ -10636,8 +10636,8 @@ lock_type:	ACCESS SHARE					{ $$ = AccessShareLock; }
 			| ACCESS EXCLUSIVE				{ $$ = AccessExclusiveLock; }
 		;
 
-opt_nowait:	NOWAIT							{ $$ = TRUE; }
-			| /*EMPTY*/						{ $$ = FALSE; }
+opt_nowait:	NOWAIT							{ $$ = true; }
+			| /*EMPTY*/						{ $$ = false; }
 		;
 
 opt_nowait_or_skip:
@@ -11104,9 +11104,9 @@ opt_table:	TABLE									{}
 		;
 
 all_or_distinct:
-			ALL										{ $$ = TRUE; }
-			| DISTINCT								{ $$ = FALSE; }
-			| /*EMPTY*/								{ $$ = FALSE; }
+			ALL										{ $$ = true; }
+			| DISTINCT								{ $$ = false; }
+			| /*EMPTY*/								{ $$ = false; }
 		;
 
 /* We use (NIL) as a placeholder to indicate that all target expressions
@@ -11535,7 +11535,7 @@ joined_table:
 					/* CROSS JOIN is same as unqualified inner join */
 					JoinExpr *n = makeNode(JoinExpr);
 					n->jointype = JOIN_INNER;
-					n->isNatural = FALSE;
+					n->isNatural = false;
 					n->larg = $1;
 					n->rarg = $4;
 					n->usingClause = NIL;
@@ -11546,7 +11546,7 @@ joined_table:
 				{
 					JoinExpr *n = makeNode(JoinExpr);
 					n->jointype = $2;
-					n->isNatural = FALSE;
+					n->isNatural = false;
 					n->larg = $1;
 					n->rarg = $4;
 					if ($5 != NULL && IsA($5, List))
@@ -11560,7 +11560,7 @@ joined_table:
 					/* letting join_type reduce to empty doesn't work */
 					JoinExpr *n = makeNode(JoinExpr);
 					n->jointype = JOIN_INNER;
-					n->isNatural = FALSE;
+					n->isNatural = false;
 					n->larg = $1;
 					n->rarg = $3;
 					if ($4 != NULL && IsA($4, List))
@@ -11573,7 +11573,7 @@ joined_table:
 				{
 					JoinExpr *n = makeNode(JoinExpr);
 					n->jointype = $3;
-					n->isNatural = TRUE;
+					n->isNatural = true;
 					n->larg = $1;
 					n->rarg = $5;
 					n->usingClause = NIL; /* figure out which columns later... */
@@ -11585,7 +11585,7 @@ joined_table:
 					/* letting join_type reduce to empty doesn't work */
 					JoinExpr *n = makeNode(JoinExpr);
 					n->jointype = JOIN_INNER;
-					n->isNatural = TRUE;
+					n->isNatural = true;
 					n->larg = $1;
 					n->rarg = $4;
 					n->usingClause = NIL; /* figure out which columns later... */
@@ -12055,7 +12055,7 @@ Typename:	SimpleTypename opt_array_bounds
 				{
 					$$ = $2;
 					$$->arrayBounds = $3;
-					$$->setof = TRUE;
+					$$->setof = true;
 				}
 			/* SQL standard syntax, currently only one-dimensional */
 			| SimpleTypename ARRAY '[' Iconst ']'
@@ -12067,7 +12067,7 @@ Typename:	SimpleTypename opt_array_bounds
 				{
 					$$ = $2;
 					$$->arrayBounds = list_make1(makeInteger($5));
-					$$->setof = TRUE;
+					$$->setof = true;
 				}
 			| SimpleTypename ARRAY
 				{
@@ -12078,7 +12078,7 @@ Typename:	SimpleTypename opt_array_bounds
 				{
 					$$ = $2;
 					$$->arrayBounds = list_make1(makeInteger(-1));
-					$$->setof = TRUE;
+					$$->setof = true;
 				}
 		;
 
@@ -12365,8 +12365,8 @@ character:	CHARACTER opt_varying
 		;
 
 opt_varying:
-			VARYING									{ $$ = TRUE; }
-			| /*EMPTY*/								{ $$ = FALSE; }
+			VARYING									{ $$ = true; }
+			| /*EMPTY*/								{ $$ = false; }
 		;
 
 /*
@@ -12418,9 +12418,9 @@ ConstInterval:
 		;
 
 opt_timezone:
-			WITH_LA TIME ZONE						{ $$ = TRUE; }
-			| WITHOUT TIME ZONE						{ $$ = FALSE; }
-			| /*EMPTY*/								{ $$ = FALSE; }
+			WITH_LA TIME ZONE						{ $$ = true; }
+			| WITHOUT TIME ZONE						{ $$ = false; }
+			| /*EMPTY*/								{ $$ = false; }
 		;
 
 opt_interval:
@@ -13181,14 +13181,14 @@ func_application: func_name '(' ')'
 			| func_name '(' VARIADIC func_arg_expr opt_sort_clause ')'
 				{
 					FuncCall *n = makeFuncCall($1, list_make1($4), @1);
-					n->func_variadic = TRUE;
+					n->func_variadic = true;
 					n->agg_order = $5;
 					$$ = (Node *)n;
 				}
 			| func_name '(' func_arg_list ',' VARIADIC func_arg_expr opt_sort_clause ')'
 				{
 					FuncCall *n = makeFuncCall($1, lappend($3, $6), @1);
-					n->func_variadic = TRUE;
+					n->func_variadic = true;
 					n->agg_order = $7;
 					$$ = (Node *)n;
 				}
@@ -13206,7 +13206,7 @@ func_application: func_name '(' ')'
 				{
 					FuncCall *n = makeFuncCall($1, $4, @1);
 					n->agg_order = $5;
-					n->agg_distinct = TRUE;
+					n->agg_distinct = true;
 					$$ = (Node *)n;
 				}
 			| func_name '(' '*' ')'
@@ -13222,7 +13222,7 @@ func_application: func_name '(' ')'
 					 * really was.
 					 */
 					FuncCall *n = makeFuncCall($1, NIL, @1);
-					n->agg_star = TRUE;
+					n->agg_star = true;
 					$$ = (Node *)n;
 				}
 		;
@@ -13266,7 +13266,7 @@ func_expr: func_application within_group_clause filter_clause over_clause
 									 errmsg("cannot use VARIADIC with WITHIN GROUP"),
 									 parser_errposition(@2)));
 						n->agg_order = $2;
-						n->agg_within_group = TRUE;
+						n->agg_within_group = true;
 					}
 					n->agg_filter = $3;
 					n->over = $4;
@@ -13556,9 +13556,9 @@ document_or_content: DOCUMENT_P						{ $$ = XMLOPTION_DOCUMENT; }
 			| CONTENT_P								{ $$ = XMLOPTION_CONTENT; }
 		;
 
-xml_whitespace_option: PRESERVE WHITESPACE_P		{ $$ = TRUE; }
-			| STRIP_P WHITESPACE_P					{ $$ = FALSE; }
-			| /*EMPTY*/								{ $$ = FALSE; }
+xml_whitespace_option: PRESERVE WHITESPACE_P		{ $$ = true; }
+			| STRIP_P WHITESPACE_P					{ $$ = false; }
+			| /*EMPTY*/								{ $$ = false; }
 		;
 
 /* We allow several variants for SQL and other compatibility. */
@@ -14430,11 +14430,11 @@ AexprConst: Iconst
 				}
 			| TRUE_P
 				{
-					$$ = makeBoolAConst(TRUE, @1);
+					$$ = makeBoolAConst(true, @1);
 				}
 			| FALSE_P
 				{
-					$$ = makeBoolAConst(FALSE, @1);
+					$$ = makeBoolAConst(false, @1);
 				}
 			| NULL_P
 				{
diff --git a/src/backend/parser/parse_utilcmd.c b/src/backend/parser/parse_utilcmd.c
index 495ba3dffc..abc08ba9dd 100644
--- a/src/backend/parser/parse_utilcmd.c
+++ b/src/backend/parser/parse_utilcmd.c
@@ -627,7 +627,7 @@ transformColumnDefinition(CreateStmtContext *cxt, ColumnDef *column)
 									column->colname, cxt->relation->relname),
 							 parser_errposition(cxt->pstate,
 												constraint->location)));
-				column->is_not_null = FALSE;
+				column->is_not_null = false;
 				saw_nullable = true;
 				break;
 
@@ -639,7 +639,7 @@ transformColumnDefinition(CreateStmtContext *cxt, ColumnDef *column)
 									column->colname, cxt->relation->relname),
 							 parser_errposition(cxt->pstate,
 												constraint->location)));
-				column->is_not_null = TRUE;
+				column->is_not_null = true;
 				saw_nullable = true;
 				break;
 
@@ -679,7 +679,7 @@ transformColumnDefinition(CreateStmtContext *cxt, ColumnDef *column)
 
 					column->identity = constraint->generated_when;
 					saw_identity = true;
-					column->is_not_null = TRUE;
+					column->is_not_null = true;
 					break;
 				}
 
@@ -2007,7 +2007,7 @@ transformIndexConstraint(Constraint *constraint, CreateStmtContext *cxt)
 		{
 			/* found column in the new table; force it to be NOT NULL */
 			if (constraint->contype == CONSTR_PRIMARY)
-				column->is_not_null = TRUE;
+				column->is_not_null = true;
 		}
 		else if (SystemAttributeByName(key, cxt->hasoids) != NULL)
 		{
diff --git a/src/backend/replication/repl_gram.y b/src/backend/replication/repl_gram.y
index ec047c827c..c2e8479820 100644
--- a/src/backend/replication/repl_gram.y
+++ b/src/backend/replication/repl_gram.y
@@ -180,22 +180,22 @@ base_backup_opt:
 			| K_PROGRESS
 				{
 				  $$ = makeDefElem("progress",
-								   (Node *)makeInteger(TRUE), -1);
+								   (Node *)makeInteger(true), -1);
 				}
 			| K_FAST
 				{
 				  $$ = makeDefElem("fast",
-								   (Node *)makeInteger(TRUE), -1);
+								   (Node *)makeInteger(true), -1);
 				}
 			| K_WAL
 				{
 				  $$ = makeDefElem("wal",
-								   (Node *)makeInteger(TRUE), -1);
+								   (Node *)makeInteger(true), -1);
 				}
 			| K_NOWAIT
 				{
 				  $$ = makeDefElem("nowait",
-								   (Node *)makeInteger(TRUE), -1);
+								   (Node *)makeInteger(true), -1);
 				}
 			| K_MAX_RATE UCONST
 				{
@@ -205,7 +205,7 @@ base_backup_opt:
 			| K_TABLESPACE_MAP
 				{
 				  $$ = makeDefElem("tablespace_map",
-								   (Node *)makeInteger(TRUE), -1);
+								   (Node *)makeInteger(true), -1);
 				}
 			;
 
@@ -246,22 +246,22 @@ create_slot_opt:
 			K_EXPORT_SNAPSHOT
 				{
 				  $$ = makeDefElem("export_snapshot",
-								   (Node *)makeInteger(TRUE), -1);
+								   (Node *)makeInteger(true), -1);
 				}
 			| K_NOEXPORT_SNAPSHOT
 				{
 				  $$ = makeDefElem("export_snapshot",
-								   (Node *)makeInteger(FALSE), -1);
+								   (Node *)makeInteger(false), -1);
 				}
 			| K_USE_SNAPSHOT
 				{
 				  $$ = makeDefElem("use_snapshot",
-								   (Node *)makeInteger(TRUE), -1);
+								   (Node *)makeInteger(true), -1);
 				}
 			| K_RESERVE_WAL
 				{
 				  $$ = makeDefElem("reserve_wal",
-								   (Node *)makeInteger(TRUE), -1);
+								   (Node *)makeInteger(true), -1);
 				}
 			;
 
diff --git a/src/backend/storage/buffer/bufmgr.c b/src/backend/storage/buffer/bufmgr.c
index 15795b0c5a..572f413d6e 100644
--- a/src/backend/storage/buffer/bufmgr.c
+++ b/src/backend/storage/buffer/bufmgr.c
@@ -975,7 +975,7 @@ ReadBuffer_common(SMgrRelation smgr, char relpersistence, ForkNumber forkNum,
  *
  * The returned buffer is pinned and is already marked as holding the
  * desired page.  If it already did have the desired page, *foundPtr is
- * set TRUE.  Otherwise, *foundPtr is set FALSE and the buffer is marked
+ * set true.  Otherwise, *foundPtr is set false and the buffer is marked
  * as IO_IN_PROGRESS; ReadBuffer will now need to do I/O to fill it.
  *
  * *foundPtr is actually redundant with the buffer's BM_VALID flag, but
@@ -1025,7 +1025,7 @@ BufferAlloc(SMgrRelation smgr, char relpersistence, ForkNumber forkNum,
 		/* Can release the mapping lock as soon as we've pinned it */
 		LWLockRelease(newPartitionLock);
 
-		*foundPtr = TRUE;
+		*foundPtr = true;
 
 		if (!valid)
 		{
@@ -1042,7 +1042,7 @@ BufferAlloc(SMgrRelation smgr, char relpersistence, ForkNumber forkNum,
 				 * If we get here, previous attempts to read the buffer must
 				 * have failed ... but we shall bravely try again.
 				 */
-				*foundPtr = FALSE;
+				*foundPtr = false;
 			}
 		}
 
@@ -1237,7 +1237,7 @@ BufferAlloc(SMgrRelation smgr, char relpersistence, ForkNumber forkNum,
 			/* Can release the mapping lock as soon as we've pinned it */
 			LWLockRelease(newPartitionLock);
 
-			*foundPtr = TRUE;
+			*foundPtr = true;
 
 			if (!valid)
 			{
@@ -1254,7 +1254,7 @@ BufferAlloc(SMgrRelation smgr, char relpersistence, ForkNumber forkNum,
 					 * If we get here, previous attempts to read the buffer
 					 * must have failed ... but we shall bravely try again.
 					 */
-					*foundPtr = FALSE;
+					*foundPtr = false;
 				}
 			}
 
@@ -1324,9 +1324,9 @@ BufferAlloc(SMgrRelation smgr, char relpersistence, ForkNumber forkNum,
 	 * read it before we did, so there's nothing left for BufferAlloc() to do.
 	 */
 	if (StartBufferIO(buf, true))
-		*foundPtr = FALSE;
+		*foundPtr = false;
 	else
-		*foundPtr = TRUE;
+		*foundPtr = true;
 
 	return buf;
 }
@@ -1564,7 +1564,7 @@ ReleaseAndReadBuffer(Buffer buffer,
  *
  * Note that ResourceOwnerEnlargeBuffers must have been done already.
  *
- * Returns TRUE if buffer is BM_VALID, else FALSE.  This provision allows
+ * Returns true if buffer is BM_VALID, else false.  This provision allows
  * some callers to avoid an extra spinlock cycle.
  */
 static bool
@@ -1688,7 +1688,7 @@ PinBuffer_Locked(BufferDesc *buf)
  * This should be applied only to shared buffers, never local ones.
  *
  * Most but not all callers want CurrentResourceOwner to be adjusted.
- * Those that don't should pass fixOwner = FALSE.
+ * Those that don't should pass fixOwner = false.
  */
 static void
 UnpinBuffer(BufferDesc *buf, bool fixOwner)
@@ -3712,7 +3712,7 @@ HoldingBufferPinThatDelaysRecovery(void)
  * ConditionalLockBufferForCleanup - as above, but don't wait to get the lock
  *
  * We won't loop, but just check once to see if the pin count is OK.  If
- * not, return FALSE with no lock held.
+ * not, return false with no lock held.
  */
 bool
 ConditionalLockBufferForCleanup(Buffer buffer)
@@ -3868,8 +3868,8 @@ WaitIO(BufferDesc *buf)
  * and output operations only on buffers that are BM_VALID and BM_DIRTY,
  * so we can always tell if the work is already done.
  *
- * Returns TRUE if we successfully marked the buffer as I/O busy,
- * FALSE if someone else already did the work.
+ * Returns true if we successfully marked the buffer as I/O busy,
+ * false if someone else already did the work.
  */
 static bool
 StartBufferIO(BufferDesc *buf, bool forInput)
@@ -3929,7 +3929,7 @@ StartBufferIO(BufferDesc *buf, bool forInput)
  *	We hold the buffer's io_in_progress lock
  *	The buffer is Pinned
  *
- * If clear_dirty is TRUE and BM_JUST_DIRTIED is not set, we clear the
+ * If clear_dirty is true and BM_JUST_DIRTIED is not set, we clear the
  * buffer's BM_DIRTY flag.  This is appropriate when terminating a
  * successful write.  The check on BM_JUST_DIRTIED is necessary to avoid
  * marking the buffer clean if it was re-dirtied while we were writing.
diff --git a/src/backend/storage/buffer/localbuf.c b/src/backend/storage/buffer/localbuf.c
index 1d540e87e8..1930f0ee0b 100644
--- a/src/backend/storage/buffer/localbuf.c
+++ b/src/backend/storage/buffer/localbuf.c
@@ -145,11 +145,11 @@ LocalBufferAlloc(SMgrRelation smgr, ForkNumber forkNum, BlockNumber blockNum,
 		ResourceOwnerRememberBuffer(CurrentResourceOwner,
 									BufferDescriptorGetBuffer(bufHdr));
 		if (buf_state & BM_VALID)
-			*foundPtr = TRUE;
+			*foundPtr = true;
 		else
 		{
 			/* Previous read attempt must have failed; try again */
-			*foundPtr = FALSE;
+			*foundPtr = false;
 		}
 		return bufHdr;
 	}
@@ -268,7 +268,7 @@ LocalBufferAlloc(SMgrRelation smgr, ForkNumber forkNum, BlockNumber blockNum,
 	buf_state += BUF_USAGECOUNT_ONE;
 	pg_atomic_unlocked_write_u32(&bufHdr->state, buf_state);
 
-	*foundPtr = FALSE;
+	*foundPtr = false;
 	return bufHdr;
 }
 
diff --git a/src/backend/storage/ipc/shmem.c b/src/backend/storage/ipc/shmem.c
index 81c291f6e3..22522676f3 100644
--- a/src/backend/storage/ipc/shmem.c
+++ b/src/backend/storage/ipc/shmem.c
@@ -257,7 +257,7 @@ ShmemAllocUnlocked(Size size)
 /*
  * ShmemAddrIsValid -- test if an address refers to shared memory
  *
- * Returns TRUE if the pointer points within the shared memory segment.
+ * Returns true if the pointer points within the shared memory segment.
  */
 bool
 ShmemAddrIsValid(const void *addr)
@@ -361,7 +361,7 @@ ShmemInitHash(const char *name,		/* table string name for shmem index */
  *		for it.  If it exists already, a pointer to the existing
  *		structure is returned.
  *
- *	Returns: pointer to the object.  *foundPtr is set TRUE if the object was
+ *	Returns: pointer to the object.  *foundPtr is set true if the object was
  *		already in the shmem index (hence, already initialized).
  *
  *	Note: before Postgres 9.0, this function returned NULL for some failure
@@ -388,7 +388,7 @@ ShmemInitStruct(const char *name, Size size, bool *foundPtr)
 			/* Must be initializing a (non-standalone) backend */
 			Assert(shmemseghdr->index != NULL);
 			structPtr = shmemseghdr->index;
-			*foundPtr = TRUE;
+			*foundPtr = true;
 		}
 		else
 		{
@@ -403,7 +403,7 @@ ShmemInitStruct(const char *name, Size size, bool *foundPtr)
 			Assert(shmemseghdr->index == NULL);
 			structPtr = ShmemAlloc(size);
 			shmemseghdr->index = structPtr;
-			*foundPtr = FALSE;
+			*foundPtr = false;
 		}
 		LWLockRelease(ShmemIndexLock);
 		return structPtr;
diff --git a/src/backend/storage/ipc/shmqueue.c b/src/backend/storage/ipc/shmqueue.c
index 1026e67b94..da67495b03 100644
--- a/src/backend/storage/ipc/shmqueue.c
+++ b/src/backend/storage/ipc/shmqueue.c
@@ -40,7 +40,7 @@ SHMQueueInit(SHM_QUEUE *queue)
 }
 
 /*
- * SHMQueueIsDetached -- TRUE if element is not currently
+ * SHMQueueIsDetached -- true if element is not currently
  *		in a queue.
  */
 bool
@@ -174,7 +174,7 @@ SHMQueuePrev(const SHM_QUEUE *queue, const SHM_QUEUE *curElem, Size linkOffset)
 }
 
 /*
- * SHMQueueEmpty -- TRUE if queue head is only element, FALSE otherwise
+ * SHMQueueEmpty -- true if queue head is only element, false otherwise
  */
 bool
 SHMQueueEmpty(const SHM_QUEUE *queue)
@@ -184,7 +184,7 @@ SHMQueueEmpty(const SHM_QUEUE *queue)
 	if (queue->prev == queue)
 	{
 		Assert(queue->next == queue);
-		return TRUE;
+		return true;
 	}
-	return FALSE;
+	return false;
 }
diff --git a/src/backend/storage/lmgr/lock.c b/src/backend/storage/lmgr/lock.c
index 2b26173924..5833086c62 100644
--- a/src/backend/storage/lmgr/lock.c
+++ b/src/backend/storage/lmgr/lock.c
@@ -768,7 +768,7 @@ LockAcquireExtended(const LOCKTAG *locktag,
 		locallock->nLocks = 0;
 		locallock->numLockOwners = 0;
 		locallock->maxLockOwners = 8;
-		locallock->holdsStrongLockCount = FALSE;
+		locallock->holdsStrongLockCount = false;
 		locallock->lockOwners = NULL;	/* in case next line fails */
 		locallock->lockOwners = (LOCALLOCKOWNER *)
 			MemoryContextAlloc(TopMemoryContext,
@@ -1264,7 +1264,7 @@ RemoveLocalLock(LOCALLOCK *locallock)
 		SpinLockAcquire(&FastPathStrongRelationLocks->mutex);
 		Assert(FastPathStrongRelationLocks->count[fasthashcode] > 0);
 		FastPathStrongRelationLocks->count[fasthashcode]--;
-		locallock->holdsStrongLockCount = FALSE;
+		locallock->holdsStrongLockCount = false;
 		SpinLockRelease(&FastPathStrongRelationLocks->mutex);
 	}
 
@@ -1578,7 +1578,7 @@ static void
 BeginStrongLockAcquire(LOCALLOCK *locallock, uint32 fasthashcode)
 {
 	Assert(StrongLockInProgress == NULL);
-	Assert(locallock->holdsStrongLockCount == FALSE);
+	Assert(locallock->holdsStrongLockCount == false);
 
 	/*
 	 * Adding to a memory location is not atomic, so we take a spinlock to
@@ -1591,7 +1591,7 @@ BeginStrongLockAcquire(LOCALLOCK *locallock, uint32 fasthashcode)
 
 	SpinLockAcquire(&FastPathStrongRelationLocks->mutex);
 	FastPathStrongRelationLocks->count[fasthashcode]++;
-	locallock->holdsStrongLockCount = TRUE;
+	locallock->holdsStrongLockCount = true;
 	StrongLockInProgress = locallock;
 	SpinLockRelease(&FastPathStrongRelationLocks->mutex);
 }
@@ -1620,11 +1620,11 @@ AbortStrongLockAcquire(void)
 		return;
 
 	fasthashcode = FastPathStrongLockHashPartition(locallock->hashcode);
-	Assert(locallock->holdsStrongLockCount == TRUE);
+	Assert(locallock->holdsStrongLockCount == true);
 	SpinLockAcquire(&FastPathStrongRelationLocks->mutex);
 	Assert(FastPathStrongRelationLocks->count[fasthashcode] > 0);
 	FastPathStrongRelationLocks->count[fasthashcode]--;
-	locallock->holdsStrongLockCount = FALSE;
+	locallock->holdsStrongLockCount = false;
 	StrongLockInProgress = NULL;
 	SpinLockRelease(&FastPathStrongRelationLocks->mutex);
 }
@@ -1857,7 +1857,7 @@ LockRelease(const LOCKTAG *locktag, LOCKMODE lockmode, bool sessionLock)
 	{
 		elog(WARNING, "you don't own a lock of type %s",
 			 lockMethodTable->lockModeNames[lockmode]);
-		return FALSE;
+		return false;
 	}
 
 	/*
@@ -1896,7 +1896,7 @@ LockRelease(const LOCKTAG *locktag, LOCKMODE lockmode, bool sessionLock)
 			/* don't release a lock belonging to another owner */
 			elog(WARNING, "you don't own a lock of type %s",
 				 lockMethodTable->lockModeNames[lockmode]);
-			return FALSE;
+			return false;
 		}
 	}
 
@@ -1907,7 +1907,7 @@ LockRelease(const LOCKTAG *locktag, LOCKMODE lockmode, bool sessionLock)
 	locallock->nLocks--;
 
 	if (locallock->nLocks > 0)
-		return TRUE;
+		return true;
 
 	/* Attempt fast release of any lock eligible for the fast path. */
 	if (EligibleForRelationFastPath(locktag, lockmode) &&
@@ -1926,7 +1926,7 @@ LockRelease(const LOCKTAG *locktag, LOCKMODE lockmode, bool sessionLock)
 		if (released)
 		{
 			RemoveLocalLock(locallock);
-			return TRUE;
+			return true;
 		}
 	}
 
@@ -1984,7 +1984,7 @@ LockRelease(const LOCKTAG *locktag, LOCKMODE lockmode, bool sessionLock)
 		elog(WARNING, "you don't own a lock of type %s",
 			 lockMethodTable->lockModeNames[lockmode]);
 		RemoveLocalLock(locallock);
-		return FALSE;
+		return false;
 	}
 
 	/*
@@ -1999,7 +1999,7 @@ LockRelease(const LOCKTAG *locktag, LOCKMODE lockmode, bool sessionLock)
 	LWLockRelease(partitionLock);
 
 	RemoveLocalLock(locallock);
-	return TRUE;
+	return true;
 }
 
 /*
@@ -3137,7 +3137,7 @@ AtPrepare_Locks(void)
 		 * entry.  We must retain the count until the prepared transaction is
 		 * committed or rolled back.
 		 */
-		locallock->holdsStrongLockCount = FALSE;
+		locallock->holdsStrongLockCount = false;
 
 		/*
 		 * Create a 2PC record.
diff --git a/src/backend/utils/adt/datetime.c b/src/backend/utils/adt/datetime.c
index a3d7dc3697..efa37644fc 100644
--- a/src/backend/utils/adt/datetime.c
+++ b/src/backend/utils/adt/datetime.c
@@ -791,10 +791,10 @@ DecodeDateTime(char **field, int *ftype, int nf,
 	int			val;
 	int			dterr;
 	int			mer = HR24;
-	bool		haveTextMonth = FALSE;
-	bool		isjulian = FALSE;
-	bool		is2digits = FALSE;
-	bool		bc = FALSE;
+	bool		haveTextMonth = false;
+	bool		isjulian = false;
+	bool		is2digits = false;
+	bool		bc = false;
 	pg_tz	   *namedTz = NULL;
 	pg_tz	   *abbrevTz = NULL;
 	pg_tz	   *valtz;
@@ -840,7 +840,7 @@ DecodeDateTime(char **field, int *ftype, int nf,
 						return DTERR_FIELD_OVERFLOW;
 
 					j2date(val, &tm->tm_year, &tm->tm_mon, &tm->tm_mday);
-					isjulian = TRUE;
+					isjulian = true;
 
 					/* Get the time zone from the end of the string */
 					dterr = DecodeTimezone(cp, tzp);
@@ -1087,7 +1087,7 @@ DecodeDateTime(char **field, int *ftype, int nf,
 								return DTERR_FIELD_OVERFLOW;
 							tmask = DTK_DATE_M;
 							j2date(val, &tm->tm_year, &tm->tm_mon, &tm->tm_mday);
-							isjulian = TRUE;
+							isjulian = true;
 
 							/* fractional Julian Day? */
 							if (*cp == '.')
@@ -1271,7 +1271,7 @@ DecodeDateTime(char **field, int *ftype, int nf,
 							tm->tm_mday = tm->tm_mon;
 							tmask = DTK_M(DAY);
 						}
-						haveTextMonth = TRUE;
+						haveTextMonth = true;
 						tm->tm_mon = val;
 						break;
 
@@ -1751,9 +1751,9 @@ DecodeTimeOnly(char **field, int *ftype, int nf,
 	int			i;
 	int			val;
 	int			dterr;
-	bool		isjulian = FALSE;
-	bool		is2digits = FALSE;
-	bool		bc = FALSE;
+	bool		isjulian = false;
+	bool		is2digits = false;
+	bool		bc = false;
 	int			mer = HR24;
 	pg_tz	   *namedTz = NULL;
 	pg_tz	   *abbrevTz = NULL;
@@ -1991,7 +1991,7 @@ DecodeTimeOnly(char **field, int *ftype, int nf,
 								return DTERR_FIELD_OVERFLOW;
 							tmask = DTK_DATE_M;
 							j2date(val, &tm->tm_year, &tm->tm_mon, &tm->tm_mday);
-							isjulian = TRUE;
+							isjulian = true;
 
 							if (*cp == '.')
 							{
@@ -2086,7 +2086,7 @@ DecodeTimeOnly(char **field, int *ftype, int nf,
 					else
 					{
 						dterr = DecodeNumber(flen, field[i],
-											 FALSE,
+											 false,
 											 (fmask | DTK_DATE_M),
 											 &tmask, tm,
 											 fsec, &is2digits);
@@ -2362,7 +2362,7 @@ DecodeTimeOnly(char **field, int *ftype, int nf,
  *	str: field to be parsed
  *	fmask: bitmask for field types already seen
  *	*tmask: receives bitmask for fields found here
- *	*is2digits: set to TRUE if we find 2-digit year
+ *	*is2digits: set to true if we find 2-digit year
  *	*tm: field values are stored into appropriate members of this struct
  */
 static int
@@ -2374,7 +2374,7 @@ DecodeDate(char *str, int fmask, int *tmask, bool *is2digits,
 	int			i,
 				len;
 	int			dterr;
-	bool		haveTextMonth = FALSE;
+	bool		haveTextMonth = false;
 	int			type,
 				val,
 				dmask = 0;
@@ -2424,7 +2424,7 @@ DecodeDate(char *str, int fmask, int *tmask, bool *is2digits,
 			{
 				case MONTH:
 					tm->tm_mon = val;
-					haveTextMonth = TRUE;
+					haveTextMonth = true;
 					break;
 
 				default:
@@ -2755,7 +2755,7 @@ DecodeNumber(int flen, char *str, bool haveTextMonth, int fmask,
 					*tmask = DTK_M(DAY);	/* YEAR is already set */
 					tm->tm_mday = tm->tm_year;
 					tm->tm_year = val;
-					*is2digits = FALSE;
+					*is2digits = false;
 				}
 				else
 				{
@@ -2859,7 +2859,7 @@ DecodeNumberField(int len, char *str, int fmask,
 			*(str + (len - 4)) = '\0';
 			tm->tm_year = atoi(str);
 			if ((len - 4) == 2)
-				*is2digits = TRUE;
+				*is2digits = true;
 
 			return DTK_DATE;
 		}
@@ -3095,7 +3095,7 @@ int
 DecodeInterval(char **field, int *ftype, int nf, int range,
 			   int *dtype, struct pg_tm *tm, fsec_t *fsec)
 {
-	bool		is_before = FALSE;
+	bool		is_before = false;
 	char	   *cp;
 	int			fmask = 0,
 				tmask,
@@ -3350,7 +3350,7 @@ DecodeInterval(char **field, int *ftype, int nf, int range,
 						break;
 
 					case AGO:
-						is_before = TRUE;
+						is_before = true;
 						type = val;
 						break;
 
@@ -4193,7 +4193,7 @@ AddPostgresIntPart(char *cp, int value, const char *units,
 	 * tad bizarre but it's how it worked before...
 	 */
 	*is_before = (value < 0);
-	*is_zero = FALSE;
+	*is_zero = false;
 	return cp + strlen(cp);
 }
 
@@ -4213,7 +4213,7 @@ AddVerboseIntPart(char *cp, int value, const char *units,
 	else if (*is_before)
 		value = -value;
 	sprintf(cp, " %d %s%s", value, units, (value == 1) ? "" : "s");
-	*is_zero = FALSE;
+	*is_zero = false;
 	return cp + strlen(cp);
 }
 
@@ -4247,8 +4247,8 @@ EncodeInterval(struct pg_tm *tm, fsec_t fsec, int style, char *str)
 	int			hour = tm->tm_hour;
 	int			min = tm->tm_min;
 	int			sec = tm->tm_sec;
-	bool		is_before = FALSE;
-	bool		is_zero = TRUE;
+	bool		is_before = false;
+	bool		is_zero = true;
 
 	/*
 	 * The sign of year and month are guaranteed to match, since they are
@@ -4403,7 +4403,7 @@ EncodeInterval(struct pg_tm *tm, fsec_t fsec, int style, char *str)
 				if (sec < 0 || (sec == 0 && fsec < 0))
 				{
 					if (is_zero)
-						is_before = TRUE;
+						is_before = true;
 					else if (!is_before)
 						*cp++ = '-';
 				}
@@ -4412,7 +4412,7 @@ EncodeInterval(struct pg_tm *tm, fsec_t fsec, int style, char *str)
 				cp = AppendSeconds(cp, sec, fsec, MAX_INTERVAL_PRECISION, false);
 				sprintf(cp, " sec%s",
 						(abs(sec) != 1 || fsec != 0) ? "s" : "");
-				is_zero = FALSE;
+				is_zero = false;
 			}
 			/* identically zero? then put in a unitless zero... */
 			if (is_zero)
diff --git a/src/backend/utils/adt/formatting.c b/src/backend/utils/adt/formatting.c
index 46f45f6654..56952d29a8 100644
--- a/src/backend/utils/adt/formatting.c
+++ b/src/backend/utils/adt/formatting.c
@@ -718,99 +718,99 @@ typedef enum
  */
 static const KeyWord DCH_keywords[] = {
 /*	name, len, id, is_digit, date_mode */
-	{"A.D.", 4, DCH_A_D, FALSE, FROM_CHAR_DATE_NONE},	/* A */
-	{"A.M.", 4, DCH_A_M, FALSE, FROM_CHAR_DATE_NONE},
-	{"AD", 2, DCH_AD, FALSE, FROM_CHAR_DATE_NONE},
-	{"AM", 2, DCH_AM, FALSE, FROM_CHAR_DATE_NONE},
-	{"B.C.", 4, DCH_B_C, FALSE, FROM_CHAR_DATE_NONE},	/* B */
-	{"BC", 2, DCH_BC, FALSE, FROM_CHAR_DATE_NONE},
-	{"CC", 2, DCH_CC, TRUE, FROM_CHAR_DATE_NONE},	/* C */
-	{"DAY", 3, DCH_DAY, FALSE, FROM_CHAR_DATE_NONE},	/* D */
-	{"DDD", 3, DCH_DDD, TRUE, FROM_CHAR_DATE_GREGORIAN},
-	{"DD", 2, DCH_DD, TRUE, FROM_CHAR_DATE_GREGORIAN},
-	{"DY", 2, DCH_DY, FALSE, FROM_CHAR_DATE_NONE},
-	{"Day", 3, DCH_Day, FALSE, FROM_CHAR_DATE_NONE},
-	{"Dy", 2, DCH_Dy, FALSE, FROM_CHAR_DATE_NONE},
-	{"D", 1, DCH_D, TRUE, FROM_CHAR_DATE_GREGORIAN},
-	{"FX", 2, DCH_FX, FALSE, FROM_CHAR_DATE_NONE},	/* F */
-	{"HH24", 4, DCH_HH24, TRUE, FROM_CHAR_DATE_NONE},	/* H */
-	{"HH12", 4, DCH_HH12, TRUE, FROM_CHAR_DATE_NONE},
-	{"HH", 2, DCH_HH, TRUE, FROM_CHAR_DATE_NONE},
-	{"IDDD", 4, DCH_IDDD, TRUE, FROM_CHAR_DATE_ISOWEEK},	/* I */
-	{"ID", 2, DCH_ID, TRUE, FROM_CHAR_DATE_ISOWEEK},
-	{"IW", 2, DCH_IW, TRUE, FROM_CHAR_DATE_ISOWEEK},
-	{"IYYY", 4, DCH_IYYY, TRUE, FROM_CHAR_DATE_ISOWEEK},
-	{"IYY", 3, DCH_IYY, TRUE, FROM_CHAR_DATE_ISOWEEK},
-	{"IY", 2, DCH_IY, TRUE, FROM_CHAR_DATE_ISOWEEK},
-	{"I", 1, DCH_I, TRUE, FROM_CHAR_DATE_ISOWEEK},
-	{"J", 1, DCH_J, TRUE, FROM_CHAR_DATE_NONE}, /* J */
-	{"MI", 2, DCH_MI, TRUE, FROM_CHAR_DATE_NONE},	/* M */
-	{"MM", 2, DCH_MM, TRUE, FROM_CHAR_DATE_GREGORIAN},
-	{"MONTH", 5, DCH_MONTH, FALSE, FROM_CHAR_DATE_GREGORIAN},
-	{"MON", 3, DCH_MON, FALSE, FROM_CHAR_DATE_GREGORIAN},
-	{"MS", 2, DCH_MS, TRUE, FROM_CHAR_DATE_NONE},
-	{"Month", 5, DCH_Month, FALSE, FROM_CHAR_DATE_GREGORIAN},
-	{"Mon", 3, DCH_Mon, FALSE, FROM_CHAR_DATE_GREGORIAN},
-	{"OF", 2, DCH_OF, FALSE, FROM_CHAR_DATE_NONE},	/* O */
-	{"P.M.", 4, DCH_P_M, FALSE, FROM_CHAR_DATE_NONE},	/* P */
-	{"PM", 2, DCH_PM, FALSE, FROM_CHAR_DATE_NONE},
-	{"Q", 1, DCH_Q, TRUE, FROM_CHAR_DATE_NONE}, /* Q */
-	{"RM", 2, DCH_RM, FALSE, FROM_CHAR_DATE_GREGORIAN}, /* R */
-	{"SSSS", 4, DCH_SSSS, TRUE, FROM_CHAR_DATE_NONE},	/* S */
-	{"SS", 2, DCH_SS, TRUE, FROM_CHAR_DATE_NONE},
-	{"TZ", 2, DCH_TZ, FALSE, FROM_CHAR_DATE_NONE},	/* T */
-	{"US", 2, DCH_US, TRUE, FROM_CHAR_DATE_NONE},	/* U */
-	{"WW", 2, DCH_WW, TRUE, FROM_CHAR_DATE_GREGORIAN},	/* W */
-	{"W", 1, DCH_W, TRUE, FROM_CHAR_DATE_GREGORIAN},
-	{"Y,YYY", 5, DCH_Y_YYY, TRUE, FROM_CHAR_DATE_GREGORIAN},	/* Y */
-	{"YYYY", 4, DCH_YYYY, TRUE, FROM_CHAR_DATE_GREGORIAN},
-	{"YYY", 3, DCH_YYY, TRUE, FROM_CHAR_DATE_GREGORIAN},
-	{"YY", 2, DCH_YY, TRUE, FROM_CHAR_DATE_GREGORIAN},
-	{"Y", 1, DCH_Y, TRUE, FROM_CHAR_DATE_GREGORIAN},
-	{"a.d.", 4, DCH_a_d, FALSE, FROM_CHAR_DATE_NONE},	/* a */
-	{"a.m.", 4, DCH_a_m, FALSE, FROM_CHAR_DATE_NONE},
-	{"ad", 2, DCH_ad, FALSE, FROM_CHAR_DATE_NONE},
-	{"am", 2, DCH_am, FALSE, FROM_CHAR_DATE_NONE},
-	{"b.c.", 4, DCH_b_c, FALSE, FROM_CHAR_DATE_NONE},	/* b */
-	{"bc", 2, DCH_bc, FALSE, FROM_CHAR_DATE_NONE},
-	{"cc", 2, DCH_CC, TRUE, FROM_CHAR_DATE_NONE},	/* c */
-	{"day", 3, DCH_day, FALSE, FROM_CHAR_DATE_NONE},	/* d */
-	{"ddd", 3, DCH_DDD, TRUE, FROM_CHAR_DATE_GREGORIAN},
-	{"dd", 2, DCH_DD, TRUE, FROM_CHAR_DATE_GREGORIAN},
-	{"dy", 2, DCH_dy, FALSE, FROM_CHAR_DATE_NONE},
-	{"d", 1, DCH_D, TRUE, FROM_CHAR_DATE_GREGORIAN},
-	{"fx", 2, DCH_FX, FALSE, FROM_CHAR_DATE_NONE},	/* f */
-	{"hh24", 4, DCH_HH24, TRUE, FROM_CHAR_DATE_NONE},	/* h */
-	{"hh12", 4, DCH_HH12, TRUE, FROM_CHAR_DATE_NONE},
-	{"hh", 2, DCH_HH, TRUE, FROM_CHAR_DATE_NONE},
-	{"iddd", 4, DCH_IDDD, TRUE, FROM_CHAR_DATE_ISOWEEK},	/* i */
-	{"id", 2, DCH_ID, TRUE, FROM_CHAR_DATE_ISOWEEK},
-	{"iw", 2, DCH_IW, TRUE, FROM_CHAR_DATE_ISOWEEK},
-	{"iyyy", 4, DCH_IYYY, TRUE, FROM_CHAR_DATE_ISOWEEK},
-	{"iyy", 3, DCH_IYY, TRUE, FROM_CHAR_DATE_ISOWEEK},
-	{"iy", 2, DCH_IY, TRUE, FROM_CHAR_DATE_ISOWEEK},
-	{"i", 1, DCH_I, TRUE, FROM_CHAR_DATE_ISOWEEK},
-	{"j", 1, DCH_J, TRUE, FROM_CHAR_DATE_NONE}, /* j */
-	{"mi", 2, DCH_MI, TRUE, FROM_CHAR_DATE_NONE},	/* m */
-	{"mm", 2, DCH_MM, TRUE, FROM_CHAR_DATE_GREGORIAN},
-	{"month", 5, DCH_month, FALSE, FROM_CHAR_DATE_GREGORIAN},
-	{"mon", 3, DCH_mon, FALSE, FROM_CHAR_DATE_GREGORIAN},
-	{"ms", 2, DCH_MS, TRUE, FROM_CHAR_DATE_NONE},
-	{"p.m.", 4, DCH_p_m, FALSE, FROM_CHAR_DATE_NONE},	/* p */
-	{"pm", 2, DCH_pm, FALSE, FROM_CHAR_DATE_NONE},
-	{"q", 1, DCH_Q, TRUE, FROM_CHAR_DATE_NONE}, /* q */
-	{"rm", 2, DCH_rm, FALSE, FROM_CHAR_DATE_GREGORIAN}, /* r */
-	{"ssss", 4, DCH_SSSS, TRUE, FROM_CHAR_DATE_NONE},	/* s */
-	{"ss", 2, DCH_SS, TRUE, FROM_CHAR_DATE_NONE},
-	{"tz", 2, DCH_tz, FALSE, FROM_CHAR_DATE_NONE},	/* t */
-	{"us", 2, DCH_US, TRUE, FROM_CHAR_DATE_NONE},	/* u */
-	{"ww", 2, DCH_WW, TRUE, FROM_CHAR_DATE_GREGORIAN},	/* w */
-	{"w", 1, DCH_W, TRUE, FROM_CHAR_DATE_GREGORIAN},
-	{"y,yyy", 5, DCH_Y_YYY, TRUE, FROM_CHAR_DATE_GREGORIAN},	/* y */
-	{"yyyy", 4, DCH_YYYY, TRUE, FROM_CHAR_DATE_GREGORIAN},
-	{"yyy", 3, DCH_YYY, TRUE, FROM_CHAR_DATE_GREGORIAN},
-	{"yy", 2, DCH_YY, TRUE, FROM_CHAR_DATE_GREGORIAN},
-	{"y", 1, DCH_Y, TRUE, FROM_CHAR_DATE_GREGORIAN},
+	{"A.D.", 4, DCH_A_D, false, FROM_CHAR_DATE_NONE},	/* A */
+	{"A.M.", 4, DCH_A_M, false, FROM_CHAR_DATE_NONE},
+	{"AD", 2, DCH_AD, false, FROM_CHAR_DATE_NONE},
+	{"AM", 2, DCH_AM, false, FROM_CHAR_DATE_NONE},
+	{"B.C.", 4, DCH_B_C, false, FROM_CHAR_DATE_NONE},	/* B */
+	{"BC", 2, DCH_BC, false, FROM_CHAR_DATE_NONE},
+	{"CC", 2, DCH_CC, true, FROM_CHAR_DATE_NONE},	/* C */
+	{"DAY", 3, DCH_DAY, false, FROM_CHAR_DATE_NONE},	/* D */
+	{"DDD", 3, DCH_DDD, true, FROM_CHAR_DATE_GREGORIAN},
+	{"DD", 2, DCH_DD, true, FROM_CHAR_DATE_GREGORIAN},
+	{"DY", 2, DCH_DY, false, FROM_CHAR_DATE_NONE},
+	{"Day", 3, DCH_Day, false, FROM_CHAR_DATE_NONE},
+	{"Dy", 2, DCH_Dy, false, FROM_CHAR_DATE_NONE},
+	{"D", 1, DCH_D, true, FROM_CHAR_DATE_GREGORIAN},
+	{"FX", 2, DCH_FX, false, FROM_CHAR_DATE_NONE},	/* F */
+	{"HH24", 4, DCH_HH24, true, FROM_CHAR_DATE_NONE},	/* H */
+	{"HH12", 4, DCH_HH12, true, FROM_CHAR_DATE_NONE},
+	{"HH", 2, DCH_HH, true, FROM_CHAR_DATE_NONE},
+	{"IDDD", 4, DCH_IDDD, true, FROM_CHAR_DATE_ISOWEEK},	/* I */
+	{"ID", 2, DCH_ID, true, FROM_CHAR_DATE_ISOWEEK},
+	{"IW", 2, DCH_IW, true, FROM_CHAR_DATE_ISOWEEK},
+	{"IYYY", 4, DCH_IYYY, true, FROM_CHAR_DATE_ISOWEEK},
+	{"IYY", 3, DCH_IYY, true, FROM_CHAR_DATE_ISOWEEK},
+	{"IY", 2, DCH_IY, true, FROM_CHAR_DATE_ISOWEEK},
+	{"I", 1, DCH_I, true, FROM_CHAR_DATE_ISOWEEK},
+	{"J", 1, DCH_J, true, FROM_CHAR_DATE_NONE}, /* J */
+	{"MI", 2, DCH_MI, true, FROM_CHAR_DATE_NONE},	/* M */
+	{"MM", 2, DCH_MM, true, FROM_CHAR_DATE_GREGORIAN},
+	{"MONTH", 5, DCH_MONTH, false, FROM_CHAR_DATE_GREGORIAN},
+	{"MON", 3, DCH_MON, false, FROM_CHAR_DATE_GREGORIAN},
+	{"MS", 2, DCH_MS, true, FROM_CHAR_DATE_NONE},
+	{"Month", 5, DCH_Month, false, FROM_CHAR_DATE_GREGORIAN},
+	{"Mon", 3, DCH_Mon, false, FROM_CHAR_DATE_GREGORIAN},
+	{"OF", 2, DCH_OF, false, FROM_CHAR_DATE_NONE},	/* O */
+	{"P.M.", 4, DCH_P_M, false, FROM_CHAR_DATE_NONE},	/* P */
+	{"PM", 2, DCH_PM, false, FROM_CHAR_DATE_NONE},
+	{"Q", 1, DCH_Q, true, FROM_CHAR_DATE_NONE}, /* Q */
+	{"RM", 2, DCH_RM, false, FROM_CHAR_DATE_GREGORIAN}, /* R */
+	{"SSSS", 4, DCH_SSSS, true, FROM_CHAR_DATE_NONE},	/* S */
+	{"SS", 2, DCH_SS, true, FROM_CHAR_DATE_NONE},
+	{"TZ", 2, DCH_TZ, false, FROM_CHAR_DATE_NONE},	/* T */
+	{"US", 2, DCH_US, true, FROM_CHAR_DATE_NONE},	/* U */
+	{"WW", 2, DCH_WW, true, FROM_CHAR_DATE_GREGORIAN},	/* W */
+	{"W", 1, DCH_W, true, FROM_CHAR_DATE_GREGORIAN},
+	{"Y,YYY", 5, DCH_Y_YYY, true, FROM_CHAR_DATE_GREGORIAN},	/* Y */
+	{"YYYY", 4, DCH_YYYY, true, FROM_CHAR_DATE_GREGORIAN},
+	{"YYY", 3, DCH_YYY, true, FROM_CHAR_DATE_GREGORIAN},
+	{"YY", 2, DCH_YY, true, FROM_CHAR_DATE_GREGORIAN},
+	{"Y", 1, DCH_Y, true, FROM_CHAR_DATE_GREGORIAN},
+	{"a.d.", 4, DCH_a_d, false, FROM_CHAR_DATE_NONE},	/* a */
+	{"a.m.", 4, DCH_a_m, false, FROM_CHAR_DATE_NONE},
+	{"ad", 2, DCH_ad, false, FROM_CHAR_DATE_NONE},
+	{"am", 2, DCH_am, false, FROM_CHAR_DATE_NONE},
+	{"b.c.", 4, DCH_b_c, false, FROM_CHAR_DATE_NONE},	/* b */
+	{"bc", 2, DCH_bc, false, FROM_CHAR_DATE_NONE},
+	{"cc", 2, DCH_CC, true, FROM_CHAR_DATE_NONE},	/* c */
+	{"day", 3, DCH_day, false, FROM_CHAR_DATE_NONE},	/* d */
+	{"ddd", 3, DCH_DDD, true, FROM_CHAR_DATE_GREGORIAN},
+	{"dd", 2, DCH_DD, true, FROM_CHAR_DATE_GREGORIAN},
+	{"dy", 2, DCH_dy, false, FROM_CHAR_DATE_NONE},
+	{"d", 1, DCH_D, true, FROM_CHAR_DATE_GREGORIAN},
+	{"fx", 2, DCH_FX, false, FROM_CHAR_DATE_NONE},	/* f */
+	{"hh24", 4, DCH_HH24, true, FROM_CHAR_DATE_NONE},	/* h */
+	{"hh12", 4, DCH_HH12, true, FROM_CHAR_DATE_NONE},
+	{"hh", 2, DCH_HH, true, FROM_CHAR_DATE_NONE},
+	{"iddd", 4, DCH_IDDD, true, FROM_CHAR_DATE_ISOWEEK},	/* i */
+	{"id", 2, DCH_ID, true, FROM_CHAR_DATE_ISOWEEK},
+	{"iw", 2, DCH_IW, true, FROM_CHAR_DATE_ISOWEEK},
+	{"iyyy", 4, DCH_IYYY, true, FROM_CHAR_DATE_ISOWEEK},
+	{"iyy", 3, DCH_IYY, true, FROM_CHAR_DATE_ISOWEEK},
+	{"iy", 2, DCH_IY, true, FROM_CHAR_DATE_ISOWEEK},
+	{"i", 1, DCH_I, true, FROM_CHAR_DATE_ISOWEEK},
+	{"j", 1, DCH_J, true, FROM_CHAR_DATE_NONE}, /* j */
+	{"mi", 2, DCH_MI, true, FROM_CHAR_DATE_NONE},	/* m */
+	{"mm", 2, DCH_MM, true, FROM_CHAR_DATE_GREGORIAN},
+	{"month", 5, DCH_month, false, FROM_CHAR_DATE_GREGORIAN},
+	{"mon", 3, DCH_mon, false, FROM_CHAR_DATE_GREGORIAN},
+	{"ms", 2, DCH_MS, true, FROM_CHAR_DATE_NONE},
+	{"p.m.", 4, DCH_p_m, false, FROM_CHAR_DATE_NONE},	/* p */
+	{"pm", 2, DCH_pm, false, FROM_CHAR_DATE_NONE},
+	{"q", 1, DCH_Q, true, FROM_CHAR_DATE_NONE}, /* q */
+	{"rm", 2, DCH_rm, false, FROM_CHAR_DATE_GREGORIAN}, /* r */
+	{"ssss", 4, DCH_SSSS, true, FROM_CHAR_DATE_NONE},	/* s */
+	{"ss", 2, DCH_SS, true, FROM_CHAR_DATE_NONE},
+	{"tz", 2, DCH_tz, false, FROM_CHAR_DATE_NONE},	/* t */
+	{"us", 2, DCH_US, true, FROM_CHAR_DATE_NONE},	/* u */
+	{"ww", 2, DCH_WW, true, FROM_CHAR_DATE_GREGORIAN},	/* w */
+	{"w", 1, DCH_W, true, FROM_CHAR_DATE_GREGORIAN},
+	{"y,yyy", 5, DCH_Y_YYY, true, FROM_CHAR_DATE_GREGORIAN},	/* y */
+	{"yyyy", 4, DCH_YYYY, true, FROM_CHAR_DATE_GREGORIAN},
+	{"yyy", 3, DCH_YYY, true, FROM_CHAR_DATE_GREGORIAN},
+	{"yy", 2, DCH_YY, true, FROM_CHAR_DATE_GREGORIAN},
+	{"y", 1, DCH_Y, true, FROM_CHAR_DATE_GREGORIAN},
 
 	/* last */
 	{NULL, 0, 0, 0, 0}
@@ -1102,7 +1102,7 @@ NUMDesc_prepare(NUMDesc *num, FormatNode *n)
 
 		case NUM_D:
 			num->flag |= NUM_F_LDECIMAL;
-			num->need_locale = TRUE;
+			num->need_locale = true;
 			/* FALLTHROUGH */
 		case NUM_DEC:
 			if (IS_DECIMAL(num))
@@ -1133,13 +1133,13 @@ NUMDesc_prepare(NUMDesc *num, FormatNode *n)
 			{
 				num->lsign = NUM_LSIGN_PRE;
 				num->pre_lsign_num = num->pre;
-				num->need_locale = TRUE;
+				num->need_locale = true;
 				num->flag |= NUM_F_LSIGN;
 			}
 			else if (num->lsign == NUM_LSIGN_NONE)
 			{
 				num->lsign = NUM_LSIGN_POST;
-				num->need_locale = TRUE;
+				num->need_locale = true;
 				num->flag |= NUM_F_LSIGN;
 			}
 			break;
@@ -1188,7 +1188,7 @@ NUMDesc_prepare(NUMDesc *num, FormatNode *n)
 
 		case NUM_L:
 		case NUM_G:
-			num->need_locale = TRUE;
+			num->need_locale = true;
 			break;
 
 		case NUM_V:
@@ -2072,17 +2072,17 @@ dump_index(const KeyWord *k, const int *index)
 #endif							/* DEBUG */
 
 /* ----------
- * Return TRUE if next format picture is not digit value
+ * Return true if next format picture is not digit value
  * ----------
  */
 static bool
 is_next_separator(FormatNode *n)
 {
 	if (n->type == NODE_TYPE_END)
-		return FALSE;
+		return false;
 
 	if (n->type == NODE_TYPE_ACTION && S_THth(n->suffix))
-		return TRUE;
+		return true;
 
 	/*
 	 * Next node
@@ -2091,19 +2091,19 @@ is_next_separator(FormatNode *n)
 
 	/* end of format string is treated like a non-digit separator */
 	if (n->type == NODE_TYPE_END)
-		return TRUE;
+		return true;
 
 	if (n->type == NODE_TYPE_ACTION)
 	{
 		if (n->key->is_digit)
-			return FALSE;
+			return false;
 
-		return TRUE;
+		return true;
 	}
 	else if (isdigit((unsigned char) n->character))
-		return FALSE;
+		return false;
 
-	return TRUE;				/* some non-digit input (separator) */
+	return true;				/* some non-digit input (separator) */
 }
 
 
@@ -3397,7 +3397,7 @@ datetime_to_char_body(TmToChar *tmtc, text *fmt, bool is_interval, Oid collid)
 		 * Allocate new memory if format picture is bigger than static cache
 		 * and do not use cache (call parser always)
 		 */
-		incache = FALSE;
+		incache = false;
 
 		format = (FormatNode *) palloc((fmt_len + 1) * sizeof(FormatNode));
 
@@ -3411,7 +3411,7 @@ datetime_to_char_body(TmToChar *tmtc, text *fmt, bool is_interval, Oid collid)
 		 */
 		DCHCacheEntry *ent = DCH_cache_fetch(fmt_str);
 
-		incache = TRUE;
+		incache = true;
 		format = ent->format;
 	}
 
@@ -3642,7 +3642,7 @@ do_to_timestamp(text *date_txt, text *fmt,
 			 * Allocate new memory if format picture is bigger than static
 			 * cache and do not use cache (call parser always)
 			 */
-			incache = FALSE;
+			incache = false;
 
 			format = (FormatNode *) palloc((fmt_len + 1) * sizeof(FormatNode));
 
@@ -3656,7 +3656,7 @@ do_to_timestamp(text *date_txt, text *fmt,
 			 */
 			DCHCacheEntry *ent = DCH_cache_fetch(fmt_str);
 
-			incache = TRUE;
+			incache = true;
 			format = ent->format;
 		}
 
@@ -4245,7 +4245,7 @@ get_last_relevant_decnum(char *num)
 static void
 NUM_numpart_from_char(NUMProc *Np, int id, int input_len)
 {
-	bool		isread = FALSE;
+	bool		isread = false;
 
 #ifdef DEBUG_TO_FROM_CHAR
 	elog(DEBUG_elog_output, " --- scan start --- id=%s",
@@ -4346,13 +4346,13 @@ NUM_numpart_from_char(NUMProc *Np, int id, int input_len)
 		else
 			Np->read_pre++;
 
-		isread = TRUE;
+		isread = true;
 
 #ifdef DEBUG_TO_FROM_CHAR
 		elog(DEBUG_elog_output, "Read digit (%c)", *Np->inout_p);
 #endif
 	}
-	else if (IS_DECIMAL(Np->Num) && Np->read_dec == FALSE)
+	else if (IS_DECIMAL(Np->Num) && Np->read_dec == false)
 	{
 		/*
 		 * We need not test IS_LDECIMAL(Np->Num) explicitly here, because
@@ -4370,8 +4370,8 @@ NUM_numpart_from_char(NUMProc *Np, int id, int input_len)
 			Np->inout_p += x - 1;
 			*Np->number_p = '.';
 			Np->number_p++;
-			Np->read_dec = TRUE;
-			isread = TRUE;
+			Np->read_dec = true;
+			isread = true;
 		}
 	}
 
@@ -4429,11 +4429,11 @@ NUM_numpart_from_char(NUMProc *Np, int id, int input_len)
 		 *
 		 * FM9.999999MI			   -> 5.01-
 		 *
-		 * if (.... && IS_LSIGN(Np->Num)==FALSE) prevents read wrong formats
+		 * if (.... && IS_LSIGN(Np->Num)==false) prevents read wrong formats
 		 * like to_number('1 -', '9S') where sign is not anchored to last
 		 * number.
 		 */
-		else if (isread == FALSE && IS_LSIGN(Np->Num) == FALSE &&
+		else if (isread == false && IS_LSIGN(Np->Num) == false &&
 				 (IS_PLUS(Np->Num) || IS_MINUS(Np->Num)))
 		{
 #ifdef DEBUG_TO_FROM_CHAR
@@ -4451,7 +4451,7 @@ NUM_numpart_from_char(NUMProc *Np, int id, int input_len)
 }
 
 #define IS_PREDEC_SPACE(_n) \
-		(IS_ZERO((_n)->Num)==FALSE && \
+		(IS_ZERO((_n)->Num)==false && \
 		 (_n)->number == (_n)->number_p && \
 		 *(_n)->number == '0' && \
 				 (_n)->Num->post != 0)
@@ -4483,15 +4483,15 @@ NUM_numpart_to_char(NUMProc *Np, int id)
 		 Np->number_p,
 		 Np->inout);
 #endif
-	Np->num_in = FALSE;
+	Np->num_in = false;
 
 	/*
 	 * Write sign if real number will write to output Note: IS_PREDEC_SPACE()
 	 * handle "9.9" --> " .1"
 	 */
-	if (Np->sign_wrote == FALSE &&
+	if (Np->sign_wrote == false &&
 		(Np->num_curr >= Np->out_pre_spaces || (IS_ZERO(Np->Num) && Np->Num->zero_start == Np->num_curr)) &&
-		(IS_PREDEC_SPACE(Np) == FALSE || (Np->last_relevant && *Np->last_relevant == '.')))
+		(IS_PREDEC_SPACE(Np) == false || (Np->last_relevant && *Np->last_relevant == '.')))
 	{
 		if (IS_LSIGN(Np->Num))
 		{
@@ -4502,14 +4502,14 @@ NUM_numpart_to_char(NUMProc *Np, int id)
 				else
 					strcpy(Np->inout_p, Np->L_positive_sign);
 				Np->inout_p += strlen(Np->inout_p);
-				Np->sign_wrote = TRUE;
+				Np->sign_wrote = true;
 			}
 		}
 		else if (IS_BRACKET(Np->Num))
 		{
 			*Np->inout_p = Np->sign == '+' ? ' ' : '<';
 			++Np->inout_p;
-			Np->sign_wrote = TRUE;
+			Np->sign_wrote = true;
 		}
 		else if (Np->sign == '+')
 		{
@@ -4518,13 +4518,13 @@ NUM_numpart_to_char(NUMProc *Np, int id)
 				*Np->inout_p = ' '; /* Write + */
 				++Np->inout_p;
 			}
-			Np->sign_wrote = TRUE;
+			Np->sign_wrote = true;
 		}
 		else if (Np->sign == '-')
 		{						/* Write - */
 			*Np->inout_p = '-';
 			++Np->inout_p;
-			Np->sign_wrote = TRUE;
+			Np->sign_wrote = true;
 		}
 	}
 
@@ -4555,7 +4555,7 @@ NUM_numpart_to_char(NUMProc *Np, int id)
 			 */
 			*Np->inout_p = '0'; /* Write '0' */
 			++Np->inout_p;
-			Np->num_in = TRUE;
+			Np->num_in = true;
 		}
 		else
 		{
@@ -4613,7 +4613,7 @@ NUM_numpart_to_char(NUMProc *Np, int id)
 				{
 					*Np->inout_p = *Np->number_p;	/* Write DIGIT */
 					++Np->inout_p;
-					Np->num_in = TRUE;
+					Np->num_in = true;
 				}
 			}
 			/* do no exceed string length */
@@ -4628,7 +4628,7 @@ NUM_numpart_to_char(NUMProc *Np, int id)
 
 		if (Np->num_curr + 1 == end)
 		{
-			if (Np->sign_wrote == TRUE && IS_BRACKET(Np->Num))
+			if (Np->sign_wrote == true && IS_BRACKET(Np->Num))
 			{
 				*Np->inout_p = Np->sign == '+' ? ' ' : '>';
 				++Np->inout_p;
@@ -4665,7 +4665,7 @@ NUM_processor(FormatNode *node, NUMDesc *Num, char *inout,
 	Np->last_relevant = NULL;
 	Np->read_post = 0;
 	Np->read_pre = 0;
-	Np->read_dec = FALSE;
+	Np->read_dec = false;
 
 	if (Np->Num->zero_start)
 		--Np->Num->zero_start;
@@ -4712,10 +4712,10 @@ NUM_processor(FormatNode *node, NUMDesc *Num, char *inout,
 		/* MI/PL/SG - write sign itself and not in number */
 		if (IS_PLUS(Np->Num) || IS_MINUS(Np->Num))
 		{
-			if (IS_PLUS(Np->Num) && IS_MINUS(Np->Num) == FALSE)
-				Np->sign_wrote = FALSE; /* need sign */
+			if (IS_PLUS(Np->Num) && IS_MINUS(Np->Num) == false)
+				Np->sign_wrote = false; /* need sign */
 			else
-				Np->sign_wrote = TRUE;	/* needn't sign */
+				Np->sign_wrote = true;	/* needn't sign */
 		}
 		else
 		{
@@ -4729,17 +4729,17 @@ NUM_processor(FormatNode *node, NUMDesc *Num, char *inout,
 			else if (Np->sign != '+' && IS_PLUS(Np->Num))
 				Np->Num->flag &= ~NUM_F_PLUS;
 
-			if (Np->sign == '+' && IS_FILLMODE(Np->Num) && IS_LSIGN(Np->Num) == FALSE)
-				Np->sign_wrote = TRUE;	/* needn't sign */
+			if (Np->sign == '+' && IS_FILLMODE(Np->Num) && IS_LSIGN(Np->Num) == false)
+				Np->sign_wrote = true;	/* needn't sign */
 			else
-				Np->sign_wrote = FALSE; /* need sign */
+				Np->sign_wrote = false; /* need sign */
 
 			if (Np->Num->lsign == NUM_LSIGN_PRE && Np->Num->pre == Np->Num->pre_lsign_num)
 				Np->Num->lsign = NUM_LSIGN_POST;
 		}
 	}
 	else
-		Np->sign = FALSE;
+		Np->sign = false;
 
 	/*
 	 * Count
@@ -4768,7 +4768,7 @@ NUM_processor(FormatNode *node, NUMDesc *Num, char *inout,
 			}
 		}
 
-		if (Np->sign_wrote == FALSE && Np->out_pre_spaces == 0)
+		if (Np->sign_wrote == false && Np->out_pre_spaces == 0)
 			++Np->num_count;
 	}
 	else
diff --git a/src/backend/utils/adt/geo_ops.c b/src/backend/utils/adt/geo_ops.c
index 0348855b11..70f3d319cc 100644
--- a/src/backend/utils/adt/geo_ops.c
+++ b/src/backend/utils/adt/geo_ops.c
@@ -1530,7 +1530,7 @@ path_close(PG_FUNCTION_ARGS)
 {
 	PATH	   *path = PG_GETARG_PATH_P_COPY(0);
 
-	path->closed = TRUE;
+	path->closed = true;
 
 	PG_RETURN_PATH_P(path);
 }
@@ -1540,7 +1540,7 @@ path_open(PG_FUNCTION_ARGS)
 {
 	PATH	   *path = PG_GETARG_PATH_P_COPY(0);
 
-	path->closed = FALSE;
+	path->closed = false;
 
 	PG_RETURN_PATH_P(path);
 }
@@ -4499,7 +4499,7 @@ poly_path(PG_FUNCTION_ARGS)
 
 	SET_VARSIZE(path, size);
 	path->npts = poly->npts;
-	path->closed = TRUE;
+	path->closed = true;
 	/* prevent instability in unused pad bytes */
 	path->dummy = 0;
 
@@ -5401,7 +5401,7 @@ plist_same(int npts, Point *p1, Point *p2)
 			printf("plist_same- ii = %d/%d after forward match\n", ii, npts);
 #endif
 			if (ii == npts)
-				return TRUE;
+				return true;
 
 			/* match not found forwards? then look backwards */
 			for (ii = 1, j = i - 1; ii < npts; ii++, j--)
@@ -5421,11 +5421,11 @@ plist_same(int npts, Point *p1, Point *p2)
 			printf("plist_same- ii = %d/%d after reverse match\n", ii, npts);
 #endif
 			if (ii == npts)
-				return TRUE;
+				return true;
 		}
 	}
 
-	return FALSE;
+	return false;
 }
 
 
diff --git a/src/backend/utils/adt/network_gist.c b/src/backend/utils/adt/network_gist.c
index a0097dae9c..a1607e8793 100644
--- a/src/backend/utils/adt/network_gist.c
+++ b/src/backend/utils/adt/network_gist.c
@@ -561,13 +561,13 @@ inet_gist_compress(PG_FUNCTION_ARGS)
 
 			gistentryinit(*retval, PointerGetDatum(r),
 						  entry->rel, entry->page,
-						  entry->offset, FALSE);
+						  entry->offset, false);
 		}
 		else
 		{
 			gistentryinit(*retval, (Datum) 0,
 						  entry->rel, entry->page,
-						  entry->offset, FALSE);
+						  entry->offset, false);
 		}
 	}
 	else
@@ -610,7 +610,7 @@ inet_gist_fetch(PG_FUNCTION_ARGS)
 
 	retval = palloc(sizeof(GISTENTRY));
 	gistentryinit(*retval, InetPGetDatum(dst), entry->rel, entry->page,
-				  entry->offset, FALSE);
+				  entry->offset, false);
 
 	PG_RETURN_POINTER(retval);
 }
diff --git a/src/backend/utils/adt/numeric.c b/src/backend/utils/adt/numeric.c
index 3e5614ece3..5c95320343 100644
--- a/src/backend/utils/adt/numeric.c
+++ b/src/backend/utils/adt/numeric.c
@@ -5447,7 +5447,7 @@ zero_var(NumericVar *var)
 static const char *
 set_var_from_str(const char *str, const char *cp, NumericVar *dest)
 {
-	bool		have_dp = FALSE;
+	bool		have_dp = false;
 	int			i;
 	unsigned char *decdigits;
 	int			sign = NUMERIC_POS;
@@ -5478,7 +5478,7 @@ set_var_from_str(const char *str, const char *cp, NumericVar *dest)
 
 	if (*cp == '.')
 	{
-		have_dp = TRUE;
+		have_dp = true;
 		cp++;
 	}
 
@@ -5511,7 +5511,7 @@ set_var_from_str(const char *str, const char *cp, NumericVar *dest)
 						(errcode(ERRCODE_INVALID_TEXT_REPRESENTATION),
 						 errmsg("invalid input syntax for type %s: \"%s\"",
 								"numeric", str)));
-			have_dp = TRUE;
+			have_dp = true;
 			cp++;
 		}
 		else
@@ -6080,7 +6080,7 @@ apply_typmod(NumericVar *var, int32 typmod)
 /*
  * Convert numeric to int8, rounding if needed.
  *
- * If overflow, return FALSE (no error is raised).  Return TRUE if okay.
+ * If overflow, return false (no error is raised).  Return true if okay.
  */
 static bool
 numericvar_to_int64(NumericVar *var, int64 *result)
@@ -6199,7 +6199,7 @@ int64_to_numericvar(int64 val, NumericVar *var)
 /*
  * Convert numeric to int128, rounding if needed.
  *
- * If overflow, return FALSE (no error is raised).  Return TRUE if okay.
+ * If overflow, return false (no error is raised).  Return true if okay.
  */
 static bool
 numericvar_to_int128(NumericVar *var, int128 *result)
diff --git a/src/backend/utils/adt/tsginidx.c b/src/backend/utils/adt/tsginidx.c
index 83a939dfd5..aba456ed88 100644
--- a/src/backend/utils/adt/tsginidx.c
+++ b/src/backend/utils/adt/tsginidx.c
@@ -295,7 +295,7 @@ gin_tsquery_consistent(PG_FUNCTION_ARGS)
 	/* int32	nkeys = PG_GETARG_INT32(3); */
 	Pointer    *extra_data = (Pointer *) PG_GETARG_POINTER(4);
 	bool	   *recheck = (bool *) PG_GETARG_POINTER(5);
-	bool		res = FALSE;
+	bool		res = false;
 
 	/* Initially assume query doesn't require recheck */
 	*recheck = false;
diff --git a/src/backend/utils/adt/tsgistidx.c b/src/backend/utils/adt/tsgistidx.c
index 7ce2699b5c..196a9381bc 100644
--- a/src/backend/utils/adt/tsgistidx.c
+++ b/src/backend/utils/adt/tsgistidx.c
@@ -240,7 +240,7 @@ gtsvector_compress(PG_FUNCTION_ARGS)
 		retval = (GISTENTRY *) palloc(sizeof(GISTENTRY));
 		gistentryinit(*retval, PointerGetDatum(res),
 					  entry->rel, entry->page,
-					  entry->offset, FALSE);
+					  entry->offset, false);
 	}
 	else if (ISSIGNKEY(DatumGetPointer(entry->key)) &&
 			 !ISALLTRUE(DatumGetPointer(entry->key)))
@@ -264,7 +264,7 @@ gtsvector_compress(PG_FUNCTION_ARGS)
 		retval = (GISTENTRY *) palloc(sizeof(GISTENTRY));
 		gistentryinit(*retval, PointerGetDatum(res),
 					  entry->rel, entry->page,
-					  entry->offset, FALSE);
+					  entry->offset, false);
 	}
 	PG_RETURN_POINTER(retval);
 }
@@ -281,7 +281,7 @@ gtsvector_decompress(PG_FUNCTION_ARGS)
 
 		gistentryinit(*retval, PointerGetDatum(key),
 					  entry->rel, entry->page,
-					  entry->offset, FALSE);
+					  entry->offset, false);
 
 		PG_RETURN_POINTER(retval);
 	}
diff --git a/src/backend/utils/adt/tsquery_gist.c b/src/backend/utils/adt/tsquery_gist.c
index 85518dc7d9..0f31c4d28f 100644
--- a/src/backend/utils/adt/tsquery_gist.c
+++ b/src/backend/utils/adt/tsquery_gist.c
@@ -37,7 +37,7 @@ gtsquery_compress(PG_FUNCTION_ARGS)
 
 		gistentryinit(*retval, TSQuerySignGetDatum(sign),
 					  entry->rel, entry->page,
-					  entry->offset, FALSE);
+					  entry->offset, false);
 	}
 
 	PG_RETURN_POINTER(retval);
@@ -80,7 +80,7 @@ gtsquery_consistent(PG_FUNCTION_ARGS)
 				retval = (key & sq) != 0;
 			break;
 		default:
-			retval = FALSE;
+			retval = false;
 	}
 	PG_RETURN_BOOL(retval);
 }
diff --git a/src/backend/utils/misc/guc.c b/src/backend/utils/misc/guc.c
index 246fea8693..8e117eb261 100644
--- a/src/backend/utils/misc/guc.c
+++ b/src/backend/utils/misc/guc.c
@@ -3952,9 +3952,9 @@ static int	num_guc_variables;
 static int	size_guc_variables;
 
 
-static bool guc_dirty;			/* TRUE if need to do commit/abort work */
+static bool guc_dirty;			/* true if need to do commit/abort work */
 
-static bool reporting_enabled;	/* TRUE to enable GUC_REPORT */
+static bool reporting_enabled;	/* true to enable GUC_REPORT */
 
 static int	GUCNestLevel = 0;	/* 1 when in main transaction */
 
@@ -4376,7 +4376,7 @@ add_placeholder_variable(const char *name, int elevel)
 
 /*
  * Look up option NAME.  If it exists, return a pointer to its record,
- * else return NULL.  If create_placeholders is TRUE, we'll create a
+ * else return NULL.  If create_placeholders is true, we'll create a
  * placeholder record for a valid-looking custom variable name.
  */
 static struct config_generic *
@@ -5645,7 +5645,7 @@ config_enum_lookup_by_value(struct config_enum *record, int val)
  * Lookup the value for an enum option with the selected name
  * (case-insensitive).
  * If the enum option is found, sets the retval value and returns
- * true. If it's not found, return FALSE and retval is set to 0.
+ * true. If it's not found, return false and retval is set to 0.
  */
 bool
 config_enum_lookup_by_name(struct config_enum *record, const char *value,
@@ -5658,12 +5658,12 @@ config_enum_lookup_by_name(struct config_enum *record, const char *value,
 		if (pg_strcasecmp(value, entry->name) == 0)
 		{
 			*retval = entry->val;
-			return TRUE;
+			return true;
 		}
 	}
 
 	*retval = 0;
-	return FALSE;
+	return false;
 }
 
 
@@ -8370,7 +8370,7 @@ show_config_by_name(PG_FUNCTION_ARGS)
 /*
  * show_config_by_name_missing_ok - equiv to SHOW X command but implemented as
  * a function.  If X does not exist, suppress the error and just return NULL
- * if missing_ok is TRUE.
+ * if missing_ok is true.
  */
 Datum
 show_config_by_name_missing_ok(PG_FUNCTION_ARGS)
@@ -9699,7 +9699,7 @@ GUCArrayReset(ArrayType *array)
  * or NULL for the Delete/Reset cases.  If skipIfNoPermissions is true, it's
  * not an error to have no permissions to set the option.
  *
- * Returns TRUE if OK, FALSE if skipIfNoPermissions is true and user does not
+ * Returns true if OK, false if skipIfNoPermissions is true and user does not
  * have permission to change this option (all other error cases result in an
  * error being thrown).
  */
@@ -9725,7 +9725,7 @@ validate_option_array_item(const char *name, const char *value,
 	 * define_custom_variable assumes we checked that.
 	 *
 	 * name is not known and can't be created as a placeholder.  Throw error,
-	 * unless skipIfNoPermissions is true, in which case return FALSE.
+	 * unless skipIfNoPermissions is true, in which case return false.
 	 */
 	gconf = find_option(name, true, WARNING);
 	if (!gconf)
diff --git a/src/interfaces/ecpg/preproc/pgc.l b/src/interfaces/ecpg/preproc/pgc.l
index 3598a200d0..06b0ca1a2e 100644
--- a/src/interfaces/ecpg/preproc/pgc.l
+++ b/src/interfaces/ecpg/preproc/pgc.l
@@ -987,12 +987,12 @@ cppline			{space}*#([^i][A-Za-z]*|{if}|{ifdef}|{ifndef}|{import})((\/\*[^*/]*\*+
 						  return (S_ANYTHING);
 					  }
 					}
-<C,xskip>{exec_sql}{ifdef}{space}*	{ ifcond = TRUE; BEGIN(xcond); }
+<C,xskip>{exec_sql}{ifdef}{space}*	{ ifcond = true; BEGIN(xcond); }
 <C,xskip>{informix_special}{ifdef}{space}* {
 					  /* are we simulating Informix? */
 					  if (INFORMIX_MODE)
 					  {
-						  ifcond = TRUE;
+						  ifcond = true;
 						  BEGIN(xcond);
 					  }
 					  else
@@ -1001,12 +1001,12 @@ cppline			{space}*#([^i][A-Za-z]*|{if}|{ifdef}|{ifndef}|{import})((\/\*[^*/]*\*+
 						  return (S_ANYTHING);
 					  }
 					}
-<C,xskip>{exec_sql}{ifndef}{space}* { ifcond = FALSE; BEGIN(xcond); }
+<C,xskip>{exec_sql}{ifndef}{space}* { ifcond = false; BEGIN(xcond); }
 <C,xskip>{informix_special}{ifndef}{space}* {
 					  /* are we simulating Informix? */
 					  if (INFORMIX_MODE)
 					  {
-						  ifcond = FALSE;
+						  ifcond = false;
 						  BEGIN(xcond);
 					  }
 					  else
@@ -1024,7 +1024,7 @@ cppline			{space}*#([^i][A-Za-z]*|{if}|{ifdef}|{ifndef}|{import})((\/\*[^*/]*\*+
 						else
 							preproc_tos--;
 
-						ifcond = TRUE; BEGIN(xcond);
+						ifcond = true; BEGIN(xcond);
 					}
 <C,xskip>{informix_special}{elif}{space}* {
 					/* are we simulating Informix? */
@@ -1037,7 +1037,7 @@ cppline			{space}*#([^i][A-Za-z]*|{if}|{ifdef}|{ifndef}|{import})((\/\*[^*/]*\*+
 						else
 							preproc_tos--;
 
-						ifcond = TRUE;
+						ifcond = true;
 						BEGIN(xcond);
 					}
 					else
@@ -1052,7 +1052,7 @@ cppline			{space}*#([^i][A-Za-z]*|{if}|{ifdef}|{ifndef}|{import})((\/\*[^*/]*\*+
 						mmfatal(PARSE_ERROR, "more than one EXEC SQL ELSE");
 					else
 					{
-						stacked_if_value[preproc_tos].else_branch = TRUE;
+						stacked_if_value[preproc_tos].else_branch = true;
 						stacked_if_value[preproc_tos].condition =
 							(stacked_if_value[preproc_tos-1].condition &&
 							 !stacked_if_value[preproc_tos].condition);
@@ -1071,7 +1071,7 @@ cppline			{space}*#([^i][A-Za-z]*|{if}|{ifdef}|{ifndef}|{import})((\/\*[^*/]*\*+
 							mmfatal(PARSE_ERROR, "more than one EXEC SQL ELSE");
 						else
 						{
-							stacked_if_value[preproc_tos].else_branch = TRUE;
+							stacked_if_value[preproc_tos].else_branch = true;
 							stacked_if_value[preproc_tos].condition =
 							(stacked_if_value[preproc_tos-1].condition &&
 							 !stacked_if_value[preproc_tos].condition);
@@ -1145,7 +1145,7 @@ cppline			{space}*#([^i][A-Za-z]*|{if}|{ifdef}|{ifndef}|{import})((\/\*[^*/]*\*+
 							 defptr = defptr->next);
 
 						preproc_tos++;
-						stacked_if_value[preproc_tos].else_branch = FALSE;
+						stacked_if_value[preproc_tos].else_branch = false;
 						stacked_if_value[preproc_tos].condition =
 						(defptr ? ifcond : !ifcond) && stacked_if_value[preproc_tos-1].condition;
 					}
@@ -1259,9 +1259,9 @@ lex_init(void)
 
 	preproc_tos = 0;
 	yylineno = 1;
-	ifcond = TRUE;
+	ifcond = true;
 	stacked_if_value[preproc_tos].condition = ifcond;
-	stacked_if_value[preproc_tos].else_branch = FALSE;
+	stacked_if_value[preproc_tos].else_branch = false;
 
 	/* initialize literal buffer to a reasonable but expansible size */
 	if (literalbuf == NULL)
@@ -1406,7 +1406,7 @@ parse_include(void)
 }
 
 /*
- * ecpg_isspace() --- return TRUE if flex scanner considers char whitespace
+ * ecpg_isspace() --- return true if flex scanner considers char whitespace
  */
 static bool
 ecpg_isspace(char ch)
diff --git a/src/interfaces/libpq/fe-connect.c b/src/interfaces/libpq/fe-connect.c
index d0e97ecdd4..3561d4dafd 100644
--- a/src/interfaces/libpq/fe-connect.c
+++ b/src/interfaces/libpq/fe-connect.c
@@ -3587,7 +3587,7 @@ closePGconn(PGconn *conn)
 	 * Don't call PQsetnonblocking() because it will fail if it's unable to
 	 * flush the connection.
 	 */
-	conn->nonblocking = FALSE;
+	conn->nonblocking = false;
 
 	/*
 	 * Close the connection, reset all transient state, flush I/O buffers.
@@ -3782,8 +3782,8 @@ PQfreeCancel(PGcancel *cancel)
  * PQcancel and PQrequestCancel: attempt to request cancellation of the
  * current operation.
  *
- * The return value is TRUE if the cancel request was successfully
- * dispatched, FALSE if not (in which case an error message is available).
+ * The return value is true if the cancel request was successfully
+ * dispatched, false if not (in which case an error message is available).
  * Note: successful dispatch is no guarantee that there will be any effect at
  * the backend.  The application must read the operation result as usual.
  *
@@ -3872,7 +3872,7 @@ internal_cancel(SockAddr *raddr, int be_pid, int be_key,
 	/* All done */
 	closesocket(tmpsock);
 	SOCK_ERRNO_SET(save_errno);
-	return TRUE;
+	return true;
 
 cancel_errReturn:
 
@@ -3890,13 +3890,13 @@ internal_cancel(SockAddr *raddr, int be_pid, int be_key,
 	if (tmpsock != PGINVALID_SOCKET)
 		closesocket(tmpsock);
 	SOCK_ERRNO_SET(save_errno);
-	return FALSE;
+	return false;
 }
 
 /*
  * PQcancel: request query cancel
  *
- * Returns TRUE if able to send the cancel request, FALSE if not.
+ * Returns true if able to send the cancel request, false if not.
  *
  * On failure, an error message is stored in *errbuf, which must be of size
  * errbufsize (recommended size is 256 bytes).  *errbuf is not changed on
@@ -3908,7 +3908,7 @@ PQcancel(PGcancel *cancel, char *errbuf, int errbufsize)
 	if (!cancel)
 	{
 		strlcpy(errbuf, "PQcancel() -- no cancel object supplied", errbufsize);
-		return FALSE;
+		return false;
 	}
 
 	return internal_cancel(&cancel->raddr, cancel->be_pid, cancel->be_key,
@@ -3918,7 +3918,7 @@ PQcancel(PGcancel *cancel, char *errbuf, int errbufsize)
 /*
  * PQrequestCancel: old, not thread-safe function for requesting query cancel
  *
- * Returns TRUE if able to send the cancel request, FALSE if not.
+ * Returns true if able to send the cancel request, false if not.
  *
  * On failure, the error message is saved in conn->errorMessage; this means
  * that this can't be used when there might be other active operations on
@@ -3934,7 +3934,7 @@ PQrequestCancel(PGconn *conn)
 
 	/* Check we have an open connection */
 	if (!conn)
-		return FALSE;
+		return false;
 
 	if (conn->sock == PGINVALID_SOCKET)
 	{
@@ -3943,7 +3943,7 @@ PQrequestCancel(PGconn *conn)
 				conn->errorMessage.maxlen);
 		conn->errorMessage.len = strlen(conn->errorMessage.data);
 
-		return FALSE;
+		return false;
 	}
 
 	r = internal_cancel(&conn->raddr, conn->be_pid, conn->be_key,
@@ -4772,7 +4772,7 @@ conninfo_init(PQExpBuffer errorMessage)
  * Returns a malloc'd PQconninfoOption array, if parsing is successful.
  * Otherwise, NULL is returned and an error message is left in errorMessage.
  *
- * If use_defaults is TRUE, default values are filled in (from a service file,
+ * If use_defaults is true, default values are filled in (from a service file,
  * environment variables, etc).
  */
 static PQconninfoOption *
@@ -4995,7 +4995,7 @@ conninfo_parse(const char *conninfo, PQExpBuffer errorMessage,
  * If not successful, NULL is returned and an error message is
  * left in errorMessage.
  * Defaults are supplied (from a service file, environment variables, etc)
- * for unspecified options, but only if use_defaults is TRUE.
+ * for unspecified options, but only if use_defaults is true.
  *
  * If expand_dbname is non-zero, and the value passed for the first occurrence
  * of "dbname" keyword is a connection string (as indicated by
@@ -5166,7 +5166,7 @@ conninfo_array_parse(const char *const *keywords, const char *const *values,
  *
  * Defaults are obtained from a service file, environment variables, etc.
  *
- * Returns TRUE if successful, otherwise FALSE; errorMessage, if supplied,
+ * Returns true if successful, otherwise false; errorMessage, if supplied,
  * is filled in upon failure.  Note that failure to locate a default value
  * is not an error condition here --- we just leave the option's value as
  * NULL.
@@ -5817,7 +5817,7 @@ conninfo_getval(PQconninfoOption *connOptions,
  *
  * If not successful, returns NULL and fills errorMessage accordingly.
  * However, if the reason of failure is an invalid keyword being passed and
- * ignoreMissing is TRUE, errorMessage will be left untouched.
+ * ignoreMissing is true, errorMessage will be left untouched.
  */
 static PQconninfoOption *
 conninfo_storeval(PQconninfoOption *connOptions,
diff --git a/src/interfaces/libpq/fe-exec.c b/src/interfaces/libpq/fe-exec.c
index e1e2d18e3a..351f8a7fe0 100644
--- a/src/interfaces/libpq/fe-exec.c
+++ b/src/interfaces/libpq/fe-exec.c
@@ -229,17 +229,17 @@ PQsetResultAttrs(PGresult *res, int numAttributes, PGresAttDesc *attDescs)
 
 	/* If attrs already exist, they cannot be overwritten. */
 	if (!res || res->numAttributes > 0)
-		return FALSE;
+		return false;
 
 	/* ignore no-op request */
 	if (numAttributes <= 0 || !attDescs)
-		return TRUE;
+		return true;
 
 	res->attDescs = (PGresAttDesc *)
 		PQresultAlloc(res, numAttributes * sizeof(PGresAttDesc));
 
 	if (!res->attDescs)
-		return FALSE;
+		return false;
 
 	res->numAttributes = numAttributes;
 	memcpy(res->attDescs, attDescs, numAttributes * sizeof(PGresAttDesc));
@@ -254,13 +254,13 @@ PQsetResultAttrs(PGresult *res, int numAttributes, PGresAttDesc *attDescs)
 			res->attDescs[i].name = res->null_field;
 
 		if (!res->attDescs[i].name)
-			return FALSE;
+			return false;
 
 		if (res->attDescs[i].format == 0)
 			res->binary = 0;
 	}
 
-	return TRUE;
+	return true;
 }
 
 /*
@@ -366,7 +366,7 @@ PQcopyResult(const PGresult *src, int flags)
 				PQclear(dest);
 				return NULL;
 			}
-			dest->events[i].resultInitialized = TRUE;
+			dest->events[i].resultInitialized = true;
 		}
 	}
 
@@ -396,7 +396,7 @@ dupEvents(PGEvent *events, int count)
 		newEvents[i].proc = events[i].proc;
 		newEvents[i].passThrough = events[i].passThrough;
 		newEvents[i].data = NULL;
-		newEvents[i].resultInitialized = FALSE;
+		newEvents[i].resultInitialized = false;
 		newEvents[i].name = strdup(events[i].name);
 		if (!newEvents[i].name)
 		{
@@ -423,11 +423,11 @@ PQsetvalue(PGresult *res, int tup_num, int field_num, char *value, int len)
 	PGresAttValue *attval;
 
 	if (!check_field_number(res, field_num))
-		return FALSE;
+		return false;
 
 	/* Invalid tup_num, must be <= ntups */
 	if (tup_num < 0 || tup_num > res->ntups)
-		return FALSE;
+		return false;
 
 	/* need to allocate a new tuple? */
 	if (tup_num == res->ntups)
@@ -437,10 +437,10 @@ PQsetvalue(PGresult *res, int tup_num, int field_num, char *value, int len)
 
 		tup = (PGresAttValue *)
 			pqResultAlloc(res, res->numAttributes * sizeof(PGresAttValue),
-						  TRUE);
+						  true);
 
 		if (!tup)
-			return FALSE;
+			return false;
 
 		/* initialize each column to NULL */
 		for (i = 0; i < res->numAttributes; i++)
@@ -451,7 +451,7 @@ PQsetvalue(PGresult *res, int tup_num, int field_num, char *value, int len)
 
 		/* add it to the array */
 		if (!pqAddTuple(res, tup))
-			return FALSE;
+			return false;
 	}
 
 	attval = &res->tuples[tup_num][field_num];
@@ -469,15 +469,15 @@ PQsetvalue(PGresult *res, int tup_num, int field_num, char *value, int len)
 	}
 	else
 	{
-		attval->value = (char *) pqResultAlloc(res, len + 1, TRUE);
+		attval->value = (char *) pqResultAlloc(res, len + 1, true);
 		if (!attval->value)
-			return FALSE;
+			return false;
 		attval->len = len;
 		memcpy(attval->value, value, len);
 		attval->value[len] = '\0';
 	}
 
-	return TRUE;
+	return true;
 }
 
 /*
@@ -489,7 +489,7 @@ PQsetvalue(PGresult *res, int tup_num, int field_num, char *value, int len)
 void *
 PQresultAlloc(PGresult *res, size_t nBytes)
 {
-	return pqResultAlloc(res, nBytes, TRUE);
+	return pqResultAlloc(res, nBytes, true);
 }
 
 /*
@@ -601,7 +601,7 @@ pqResultAlloc(PGresult *res, size_t nBytes, bool isBinary)
 char *
 pqResultStrdup(PGresult *res, const char *str)
 {
-	char	   *space = (char *) pqResultAlloc(res, strlen(str) + 1, FALSE);
+	char	   *space = (char *) pqResultAlloc(res, strlen(str) + 1, false);
 
 	if (space)
 		strcpy(space, str);
@@ -831,7 +831,7 @@ pqInternalNotice(const PGNoticeHooks *hooks, const char *fmt,...)
 	 * Result text is always just the primary message + newline. If we can't
 	 * allocate it, don't bother invoking the receiver.
 	 */
-	res->errMsg = (char *) pqResultAlloc(res, strlen(msgBuf) + 2, FALSE);
+	res->errMsg = (char *) pqResultAlloc(res, strlen(msgBuf) + 2, false);
 	if (res->errMsg)
 	{
 		sprintf(res->errMsg, "%s\n", msgBuf);
@@ -847,7 +847,7 @@ pqInternalNotice(const PGNoticeHooks *hooks, const char *fmt,...)
 /*
  * pqAddTuple
  *	  add a row pointer to the PGresult structure, growing it if necessary
- *	  Returns TRUE if OK, FALSE if not enough memory to add the row
+ *	  Returns true if OK, false if not enough memory to add the row
  */
 static bool
 pqAddTuple(PGresult *res, PGresAttValue *tup)
@@ -875,13 +875,13 @@ pqAddTuple(PGresult *res, PGresAttValue *tup)
 			newTuples = (PGresAttValue **)
 				realloc(res->tuples, newSize * sizeof(PGresAttValue *));
 		if (!newTuples)
-			return FALSE;		/* malloc or realloc failed */
+			return false;		/* malloc or realloc failed */
 		res->tupArrSize = newSize;
 		res->tuples = newTuples;
 	}
 	res->tuples[res->ntups] = tup;
 	res->ntups++;
-	return TRUE;
+	return true;
 }
 
 /*
@@ -896,7 +896,7 @@ pqSaveMessageField(PGresult *res, char code, const char *value)
 		pqResultAlloc(res,
 					  offsetof(PGMessageField, contents) +
 					  strlen(value) + 1,
-					  TRUE);
+					  true);
 	if (!pfield)
 		return;					/* out of memory? */
 	pfield->code = code;
@@ -1060,7 +1060,7 @@ pqRowProcessor(PGconn *conn, const char **errmsgp)
 	 * memory for gettext() to do anything.
 	 */
 	tup = (PGresAttValue *)
-		pqResultAlloc(res, nfields * sizeof(PGresAttValue), TRUE);
+		pqResultAlloc(res, nfields * sizeof(PGresAttValue), true);
 	if (tup == NULL)
 		goto fail;
 
@@ -1674,14 +1674,14 @@ parseInput(PGconn *conn)
 
 /*
  * PQisBusy
- *	 Return TRUE if PQgetResult would block waiting for input.
+ *	 Return true if PQgetResult would block waiting for input.
  */
 
 int
 PQisBusy(PGconn *conn)
 {
 	if (!conn)
-		return FALSE;
+		return false;
 
 	/* Parse any available data, if our state permits. */
 	parseInput(conn);
@@ -1720,7 +1720,7 @@ PQgetResult(PGconn *conn)
 		 */
 		while ((flushResult = pqFlush(conn)) > 0)
 		{
-			if (pqWait(FALSE, TRUE, conn))
+			if (pqWait(false, true, conn))
 			{
 				flushResult = -1;
 				break;
@@ -1729,7 +1729,7 @@ PQgetResult(PGconn *conn)
 
 		/* Wait for some more data, and load it. */
 		if (flushResult ||
-			pqWait(TRUE, FALSE, conn) ||
+			pqWait(true, false, conn) ||
 			pqReadData(conn) < 0)
 		{
 			/*
@@ -1793,7 +1793,7 @@ PQgetResult(PGconn *conn)
 				res->resultStatus = PGRES_FATAL_ERROR;
 				break;
 			}
-			res->events[i].resultInitialized = TRUE;
+			res->events[i].resultInitialized = true;
 		}
 	}
 
@@ -2695,22 +2695,22 @@ PQbinaryTuples(const PGresult *res)
 
 /*
  * Helper routines to range-check field numbers and tuple numbers.
- * Return TRUE if OK, FALSE if not
+ * Return true if OK, false if not
  */
 
 static int
 check_field_number(const PGresult *res, int field_num)
 {
 	if (!res)
-		return FALSE;			/* no way to display error message... */
+		return false;			/* no way to display error message... */
 	if (field_num < 0 || field_num >= res->numAttributes)
 	{
 		pqInternalNotice(&res->noticeHooks,
 						 "column number %d is out of range 0..%d",
 						 field_num, res->numAttributes - 1);
-		return FALSE;
+		return false;
 	}
-	return TRUE;
+	return true;
 }
 
 static int
@@ -2718,38 +2718,38 @@ check_tuple_field_number(const PGresult *res,
 						 int tup_num, int field_num)
 {
 	if (!res)
-		return FALSE;			/* no way to display error message... */
+		return false;			/* no way to display error message... */
 	if (tup_num < 0 || tup_num >= res->ntups)
 	{
 		pqInternalNotice(&res->noticeHooks,
 						 "row number %d is out of range 0..%d",
 						 tup_num, res->ntups - 1);
-		return FALSE;
+		return false;
 	}
 	if (field_num < 0 || field_num >= res->numAttributes)
 	{
 		pqInternalNotice(&res->noticeHooks,
 						 "column number %d is out of range 0..%d",
 						 field_num, res->numAttributes - 1);
-		return FALSE;
+		return false;
 	}
-	return TRUE;
+	return true;
 }
 
 static int
 check_param_number(const PGresult *res, int param_num)
 {
 	if (!res)
-		return FALSE;			/* no way to display error message... */
+		return false;			/* no way to display error message... */
 	if (param_num < 0 || param_num >= res->numParameters)
 	{
 		pqInternalNotice(&res->noticeHooks,
 						 "parameter number %d is out of range 0..%d",
 						 param_num, res->numParameters - 1);
-		return FALSE;
+		return false;
 	}
 
-	return TRUE;
+	return true;
 }
 
 /*
@@ -3126,8 +3126,8 @@ PQparamtype(const PGresult *res, int param_num)
 
 
 /* PQsetnonblocking:
- *	sets the PGconn's database connection non-blocking if the arg is TRUE
- *	or makes it blocking if the arg is FALSE, this will not protect
+ *	sets the PGconn's database connection non-blocking if the arg is true
+ *	or makes it blocking if the arg is false, this will not protect
  *	you from PQexec(), you'll only be safe when using the non-blocking API.
  *	Needs to be called only on a connected database connection.
  */
@@ -3139,7 +3139,7 @@ PQsetnonblocking(PGconn *conn, int arg)
 	if (!conn || conn->status == CONNECTION_BAD)
 		return -1;
 
-	barg = (arg ? TRUE : FALSE);
+	barg = (arg ? true : false);
 
 	/* early out if the socket is already in the state requested */
 	if (barg == conn->nonblocking)
@@ -3162,7 +3162,7 @@ PQsetnonblocking(PGconn *conn, int arg)
 
 /*
  * return the blocking status of the database connection
- *		TRUE == nonblocking, FALSE == blocking
+ *		true == nonblocking, false == blocking
  */
 int
 PQisnonblocking(const PGconn *conn)
diff --git a/src/interfaces/libpq/fe-misc.c b/src/interfaces/libpq/fe-misc.c
index cac6359585..f10c1f87ff 100644
--- a/src/interfaces/libpq/fe-misc.c
+++ b/src/interfaces/libpq/fe-misc.c
@@ -936,7 +936,7 @@ pqSendSome(PGconn *conn, int len)
 				break;
 			}
 
-			if (pqWait(TRUE, TRUE, conn))
+			if (pqWait(true, true, conn))
 			{
 				result = -1;
 				break;
diff --git a/src/interfaces/libpq/fe-protocol2.c b/src/interfaces/libpq/fe-protocol2.c
index a58f701e18..2af6d65d89 100644
--- a/src/interfaces/libpq/fe-protocol2.c
+++ b/src/interfaces/libpq/fe-protocol2.c
@@ -584,7 +584,7 @@ pqParseInput2(PGconn *conn)
 					if (conn->result != NULL)
 					{
 						/* Read another tuple of a normal query response */
-						if (getAnotherTuple(conn, FALSE))
+						if (getAnotherTuple(conn, false))
 							return;
 						/* getAnotherTuple() moves inStart itself */
 						continue;
@@ -602,7 +602,7 @@ pqParseInput2(PGconn *conn)
 					if (conn->result != NULL)
 					{
 						/* Read another tuple of a normal query response */
-						if (getAnotherTuple(conn, TRUE))
+						if (getAnotherTuple(conn, true))
 							return;
 						/* getAnotherTuple() moves inStart itself */
 						continue;
@@ -680,7 +680,7 @@ getRowDescriptions(PGconn *conn)
 	if (nfields > 0)
 	{
 		result->attDescs = (PGresAttDesc *)
-			pqResultAlloc(result, nfields * sizeof(PGresAttDesc), TRUE);
+			pqResultAlloc(result, nfields * sizeof(PGresAttDesc), true);
 		if (!result->attDescs)
 		{
 			errmsg = NULL;		/* means "out of memory", see below */
@@ -1219,7 +1219,7 @@ pqGetCopyData2(PGconn *conn, char **buffer, int async)
 		if (async)
 			return 0;
 		/* Need to load more data */
-		if (pqWait(TRUE, FALSE, conn) ||
+		if (pqWait(true, false, conn) ||
 			pqReadData(conn) < 0)
 			return -2;
 	}
@@ -1264,7 +1264,7 @@ pqGetline2(PGconn *conn, char *s, int maxlen)
 		else
 		{
 			/* need to load more data */
-			if (pqWait(TRUE, FALSE, conn) ||
+			if (pqWait(true, false, conn) ||
 				pqReadData(conn) < 0)
 			{
 				result = EOF;
@@ -1485,7 +1485,7 @@ pqFunctionCall2(PGconn *conn, Oid fnid,
 		if (needInput)
 		{
 			/* Wait for some data to arrive (or for the channel to close) */
-			if (pqWait(TRUE, FALSE, conn) ||
+			if (pqWait(true, false, conn) ||
 				pqReadData(conn) < 0)
 				break;
 		}
diff --git a/src/interfaces/libpq/fe-protocol3.c b/src/interfaces/libpq/fe-protocol3.c
index a484fe80a1..ce72eae23a 100644
--- a/src/interfaces/libpq/fe-protocol3.c
+++ b/src/interfaces/libpq/fe-protocol3.c
@@ -511,7 +511,7 @@ getRowDescriptions(PGconn *conn, int msgLength)
 	if (nfields > 0)
 	{
 		result->attDescs = (PGresAttDesc *)
-			pqResultAlloc(result, nfields * sizeof(PGresAttDesc), TRUE);
+			pqResultAlloc(result, nfields * sizeof(PGresAttDesc), true);
 		if (!result->attDescs)
 		{
 			errmsg = NULL;		/* means "out of memory", see below */
@@ -669,7 +669,7 @@ getParamDescriptions(PGconn *conn, int msgLength)
 	if (nparams > 0)
 	{
 		result->paramDescs = (PGresParamDesc *)
-			pqResultAlloc(result, nparams * sizeof(PGresParamDesc), TRUE);
+			pqResultAlloc(result, nparams * sizeof(PGresParamDesc), true);
 		if (!result->paramDescs)
 			goto advance_and_error;
 		MemSet(result->paramDescs, 0, nparams * sizeof(PGresParamDesc));
@@ -1467,7 +1467,7 @@ getCopyStart(PGconn *conn, ExecStatusType copytype)
 	if (nfields > 0)
 	{
 		result->attDescs = (PGresAttDesc *)
-			pqResultAlloc(result, nfields * sizeof(PGresAttDesc), TRUE);
+			pqResultAlloc(result, nfields * sizeof(PGresAttDesc), true);
 		if (!result->attDescs)
 			goto failure;
 		MemSet(result->attDescs, 0, nfields * sizeof(PGresAttDesc));
@@ -1658,7 +1658,7 @@ pqGetCopyData3(PGconn *conn, char **buffer, int async)
 			if (async)
 				return 0;
 			/* Need to load more data */
-			if (pqWait(TRUE, FALSE, conn) ||
+			if (pqWait(true, false, conn) ||
 				pqReadData(conn) < 0)
 				return -2;
 			continue;
@@ -1716,7 +1716,7 @@ pqGetline3(PGconn *conn, char *s, int maxlen)
 	while ((status = PQgetlineAsync(conn, s, maxlen - 1)) == 0)
 	{
 		/* need to load more data */
-		if (pqWait(TRUE, FALSE, conn) ||
+		if (pqWait(true, false, conn) ||
 			pqReadData(conn) < 0)
 		{
 			*s = '\0';
@@ -1969,7 +1969,7 @@ pqFunctionCall3(PGconn *conn, Oid fnid,
 		if (needInput)
 		{
 			/* Wait for some data to arrive (or for the channel to close) */
-			if (pqWait(TRUE, FALSE, conn) ||
+			if (pqWait(true, false, conn) ||
 				pqReadData(conn) < 0)
 				break;
 		}
diff --git a/src/interfaces/libpq/libpq-events.c b/src/interfaces/libpq/libpq-events.c
index e533017a03..883e2af8f4 100644
--- a/src/interfaces/libpq/libpq-events.c
+++ b/src/interfaces/libpq/libpq-events.c
@@ -44,12 +44,12 @@ PQregisterEventProc(PGconn *conn, PGEventProc proc,
 	PGEventRegister regevt;
 
 	if (!proc || !conn || !name || !*name)
-		return FALSE;			/* bad arguments */
+		return false;			/* bad arguments */
 
 	for (i = 0; i < conn->nEvents; i++)
 	{
 		if (conn->events[i].proc == proc)
-			return FALSE;		/* already registered */
+			return false;		/* already registered */
 	}
 
 	if (conn->nEvents >= conn->eventArraySize)
@@ -64,7 +64,7 @@ PQregisterEventProc(PGconn *conn, PGEventProc proc,
 			e = (PGEvent *) malloc(newSize * sizeof(PGEvent));
 
 		if (!e)
-			return FALSE;
+			return false;
 
 		conn->eventArraySize = newSize;
 		conn->events = e;
@@ -73,10 +73,10 @@ PQregisterEventProc(PGconn *conn, PGEventProc proc,
 	conn->events[conn->nEvents].proc = proc;
 	conn->events[conn->nEvents].name = strdup(name);
 	if (!conn->events[conn->nEvents].name)
-		return FALSE;
+		return false;
 	conn->events[conn->nEvents].passThrough = passThrough;
 	conn->events[conn->nEvents].data = NULL;
-	conn->events[conn->nEvents].resultInitialized = FALSE;
+	conn->events[conn->nEvents].resultInitialized = false;
 	conn->nEvents++;
 
 	regevt.conn = conn;
@@ -84,10 +84,10 @@ PQregisterEventProc(PGconn *conn, PGEventProc proc,
 	{
 		conn->nEvents--;
 		free(conn->events[conn->nEvents].name);
-		return FALSE;
+		return false;
 	}
 
-	return TRUE;
+	return true;
 }
 
 /*
@@ -100,18 +100,18 @@ PQsetInstanceData(PGconn *conn, PGEventProc proc, void *data)
 	int			i;
 
 	if (!conn || !proc)
-		return FALSE;
+		return false;
 
 	for (i = 0; i < conn->nEvents; i++)
 	{
 		if (conn->events[i].proc == proc)
 		{
 			conn->events[i].data = data;
-			return TRUE;
+			return true;
 		}
 	}
 
-	return FALSE;
+	return false;
 }
 
 /*
@@ -144,18 +144,18 @@ PQresultSetInstanceData(PGresult *result, PGEventProc proc, void *data)
 	int			i;
 
 	if (!result || !proc)
-		return FALSE;
+		return false;
 
 	for (i = 0; i < result->nEvents; i++)
 	{
 		if (result->events[i].proc == proc)
 		{
 			result->events[i].data = data;
-			return TRUE;
+			return true;
 		}
 	}
 
-	return FALSE;
+	return false;
 }
 
 /*
@@ -187,7 +187,7 @@ PQfireResultCreateEvents(PGconn *conn, PGresult *res)
 	int			i;
 
 	if (!res)
-		return FALSE;
+		return false;
 
 	for (i = 0; i < res->nEvents; i++)
 	{
@@ -199,11 +199,11 @@ PQfireResultCreateEvents(PGconn *conn, PGresult *res)
 			evt.result = res;
 			if (!res->events[i].proc(PGEVT_RESULTCREATE, &evt,
 									 res->events[i].passThrough))
-				return FALSE;
+				return false;
 
-			res->events[i].resultInitialized = TRUE;
+			res->events[i].resultInitialized = true;
 		}
 	}
 
-	return TRUE;
+	return true;
 }
diff --git a/src/pl/plpgsql/src/pl_exec.c b/src/pl/plpgsql/src/pl_exec.c
index 616f5e30f8..c955604c9b 100644
--- a/src/pl/plpgsql/src/pl_exec.c
+++ b/src/pl/plpgsql/src/pl_exec.c
@@ -5474,12 +5474,12 @@ exec_for_query(PLpgSQL_execstate *estate, PLpgSQL_stmt_forq *stmt,
  *								a Datum by directly calling ExecEvalExpr().
  *
  * If successful, store results into *result, *isNull, *rettype, *rettypmod
- * and return TRUE.  If the expression cannot be handled by simple evaluation,
- * return FALSE.
+ * and return true.  If the expression cannot be handled by simple evaluation,
+ * return false.
  *
  * Because we only store one execution tree for a simple expression, we
  * can't handle recursion cases.  So, if we see the tree is already busy
- * with an evaluation in the current xact, we just return FALSE and let the
+ * with an evaluation in the current xact, we just return false and let the
  * caller run the expression the hard way.  (Other alternatives such as
  * creating a new tree for a recursive call either introduce memory leaks,
  * or add enough bookkeeping to be doubtful wins anyway.)  Another case that
@@ -6291,7 +6291,7 @@ exec_cast_value(PLpgSQL_execstate *estate,
  * or NULL if the cast is a mere no-op relabeling.  If there's work to be
  * done, the cast_exprstate field contains an expression evaluation tree
  * based on a CaseTestExpr input, and the cast_in_use field should be set
- * TRUE while executing it.
+ * true while executing it.
  * ----------
  */
 static plpgsql_CastHashEntry *
-- 
2.14.1


From dd893cb2b646fd9d372a8ef88ca4e6f7c87c376d 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 3/8] Remove TRUE and FALSE

Code should be using true and false.  Existing code can be changed to
those in a backward compatible way.
---
 src/include/c.h | 12 ++----------
 1 file changed, 2 insertions(+), 10 deletions(-)

diff --git a/src/include/c.h b/src/include/c.h
index 9066e3c578..9472afd8b9 100644
--- a/src/include/c.h
+++ b/src/include/c.h
@@ -27,7 +27,7 @@
  *	  -------	------------------------------------------------
  *		0)		pg_config.h and standard system headers
  *		1)		hacks to cope with non-ANSI C compilers
- *		2)		bool, true, false, TRUE, FALSE, NULL
+ *		2)		bool, true, false, NULL
  *		3)		standard system types
  *		4)		IsValid macros for system types
  *		5)		offsetof, lengthof, endof, alignment
@@ -184,7 +184,7 @@
 #endif
 
 /* ----------------------------------------------------------------
- *				Section 2:	bool, true, false, TRUE, FALSE, NULL
+ *				Section 2:	bool, true, false, NULL
  * ----------------------------------------------------------------
  */
 
@@ -213,14 +213,6 @@ typedef char bool;
 
 typedef bool *BoolPtr;
 
-#ifndef TRUE
-#define TRUE	1
-#endif
-
-#ifndef FALSE
-#define FALSE	0
-#endif
-
 /*
  * NULL
  *		Null pointer.
-- 
2.14.1


From 34128fa0fa50be161bf8db783c9dd597b171614f 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 4/8] Remove BoolPtr type

Not used and doesn't seem useful.
---
 src/include/c.h | 2 --
 1 file changed, 2 deletions(-)

diff --git a/src/include/c.h b/src/include/c.h
index 9472afd8b9..0f078ea5f0 100644
--- a/src/include/c.h
+++ b/src/include/c.h
@@ -211,8 +211,6 @@ typedef char bool;
 #endif
 #endif							/* not C++ */
 
-typedef bool *BoolPtr;
-
 /*
  * NULL
  *		Null pointer.
-- 
2.14.1


From af82101621a5ebc18cf5ffd47f68d4b1c7ec979a 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 5/8] Make casting between bool and GinTernaryValue more robust

These two types are both defined as char and are supposed to be castable
to each other.  But when stdbool.h is used, this is not guaranteed.  So
add provisions for different sizes of bool and define GinTernaryValue
accordingly.
---
 src/backend/utils/adt/tsginidx.c |  2 +-
 src/include/access/gin.h         | 14 ++++++++++----
 src/include/c.h                  |  1 +
 3 files changed, 12 insertions(+), 5 deletions(-)

diff --git a/src/backend/utils/adt/tsginidx.c b/src/backend/utils/adt/tsginidx.c
index aba456ed88..fa792b84dc 100644
--- a/src/backend/utils/adt/tsginidx.c
+++ b/src/backend/utils/adt/tsginidx.c
@@ -309,7 +309,7 @@ gin_tsquery_consistent(PG_FUNCTION_ARGS)
 		 * query.
 		 */
 		gcv.first_item = GETQUERY(query);
-		gcv.check = check;
+		gcv.check = (GinTernaryValue *) check;
 		gcv.map_item_operand = (int *) (extra_data[0]);
 		gcv.need_recheck = recheck;
 
diff --git a/src/include/access/gin.h b/src/include/access/gin.h
index ec83058095..d58af1d6a1 100644
--- a/src/include/access/gin.h
+++ b/src/include/access/gin.h
@@ -51,14 +51,20 @@ typedef struct GinStatsData
 /*
  * A ternary value used by tri-consistent functions.
  *
- * For convenience, this is compatible with booleans. A boolean can be
+ * For convenience, this is compatible with bools. A bool can be
  * safely cast to a GinTernaryValue.
  */
+#if SIZEOF_BOOL == 1
 typedef char GinTernaryValue;
+#elif SIZEOF_BOOL == 4
+typedef int GinTernaryValue;
+#else
+#error unsupported SIZEOF_BOOL
+#endif
 
-#define GIN_FALSE		0		/* item is not present / does not match */
-#define GIN_TRUE		1		/* item is present / matches */
-#define GIN_MAYBE		2		/* don't know if item is present / don't know
+#define GIN_FALSE		((GinTernaryValue) 0)		/* item is not present / does not match */
+#define GIN_TRUE		((GinTernaryValue) 1)		/* item is present / matches */
+#define GIN_MAYBE		((GinTernaryValue) 2)		/* don't know if item is present / don't know
 								 * if matches */
 
 #define DatumGetGinTernaryValue(X) ((GinTernaryValue)(X))
diff --git a/src/include/c.h b/src/include/c.h
index 0f078ea5f0..cbf10da66c 100644
--- a/src/include/c.h
+++ b/src/include/c.h
@@ -200,6 +200,7 @@
 
 #ifndef bool
 typedef char bool;
+#define SIZEOF_BOOL 1
 #endif
 
 #ifndef true
-- 
2.14.1


From 27f6d43da62aeb2b03492826dba60e5f65993130 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 6/8] 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 7abfda3d3a..b11f871b63 100644
--- a/src/backend/catalog/Catalog.pm
+++ b/src/backend/catalog/Catalog.pm
@@ -31,6 +31,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 cbf10da66c..28f8d2bf75 100644
--- a/src/include/c.h
+++ b/src/include/c.h
@@ -212,6 +212,15 @@ typedef char bool;
 #endif
 #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;
+
 /*
  * NULL
  *		Null pointer.
diff --git a/src/include/catalog/pg_aggregate.h b/src/include/catalog/pg_aggregate.h
index 4d5b9bb9a6..98baf5caf5 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;
 	Oid			aggsortop;
 	Oid			aggtranstype;
 	int32		aggtransspace;
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 0682d7eb22..70a691f8f3 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 28dbc747d5..2eeb304dd2 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 ffabc2003b..23119b642e 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 8b33b4e0ea..4498eb63e8 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 8ae6b7143d..753b2d0e67 100644
--- a/src/include/catalog/pg_sequence.h
+++ b/src/include/catalog/pg_sequence.h
@@ -14,7 +14,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 3713a56bbd..55f072c56c 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 ffdb452b02..ba4b48c679 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;
-- 
2.14.1


From 65f7cfa613111949ffbf0dcff4f4aab1fd4f1cb8 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 7/8] Avoid use of bool in thread_test.c

It's not necessary for such a small program, and it causes unnecessary
extra work to get the correct definition of bool.
---
 src/test/thread/thread_test.c | 33 ++++++++++-----------------------
 1 file changed, 10 insertions(+), 23 deletions(-)

diff --git a/src/test/thread/thread_test.c b/src/test/thread/thread_test.c
index 32ce80e57f..282a95872c 100644
--- a/src/test/thread/thread_test.c
+++ b/src/test/thread/thread_test.c
@@ -22,19 +22,6 @@
 
 #if !defined(IN_CONFIGURE) && !defined(WIN32)
 #include "postgres.h"
-#else
-/* From src/include/c.h" */
-#ifndef bool
-typedef char bool;
-#endif
-
-#ifndef true
-#define true	((bool) 1)
-#endif
-
-#ifndef false
-#define false	((bool) 0)
-#endif
 #endif
 
 #include <stdio.h>
@@ -93,23 +80,23 @@ static volatile int errno2_set = 0;
 #ifndef HAVE_STRERROR_R
 static char *strerror_p1;
 static char *strerror_p2;
-static bool strerror_threadsafe = false;
+static int strerror_threadsafe = 0;
 #endif
 
 #if !defined(WIN32) && !defined(HAVE_GETPWUID_R)
 static struct passwd *passwd_p1;
 static struct passwd *passwd_p2;
-static bool getpwuid_threadsafe = false;
+static int getpwuid_threadsafe = 0;
 #endif
 
 #if !defined(HAVE_GETADDRINFO) && !defined(HAVE_GETHOSTBYNAME_R)
 static struct hostent *hostent_p1;
 static struct hostent *hostent_p2;
 static char myhostname[MAXHOSTNAMELEN];
-static bool gethostbyname_threadsafe = false;
+static int gethostbyname_threadsafe = 0;
 #endif
 
-static bool platform_is_threadsafe = true;
+static int platform_is_threadsafe = 1;
 
 int
 main(int argc, char *argv[])
@@ -187,17 +174,17 @@ main(int argc, char *argv[])
 
 #ifndef HAVE_STRERROR_R
 	if (strerror_p1 != strerror_p2)
-		strerror_threadsafe = true;
+		strerror_threadsafe = 1;
 #endif
 
 #if !defined(WIN32) && !defined(HAVE_GETPWUID_R)
 	if (passwd_p1 != passwd_p2)
-		getpwuid_threadsafe = true;
+		getpwuid_threadsafe = 1;
 #endif
 
 #if !defined(HAVE_GETADDRINFO) && !defined(HAVE_GETHOSTBYNAME_R)
 	if (hostent_p1 != hostent_p2)
-		gethostbyname_threadsafe = true;
+		gethostbyname_threadsafe = 1;
 #endif
 
 	/* close down threads */
@@ -218,7 +205,7 @@ main(int argc, char *argv[])
 	else
 	{
 		printf("not thread-safe. **\n");
-		platform_is_threadsafe = false;
+		platform_is_threadsafe = 0;
 	}
 #endif
 
@@ -233,7 +220,7 @@ main(int argc, char *argv[])
 	else
 	{
 		printf("not thread-safe. **\n");
-		platform_is_threadsafe = false;
+		platform_is_threadsafe = 0;
 	}
 #endif
 
@@ -249,7 +236,7 @@ main(int argc, char *argv[])
 	else
 	{
 		printf("not thread-safe. **\n");
-		platform_is_threadsafe = false;
+		platform_is_threadsafe = 0;
 	}
 #endif
 
-- 
2.14.1


From ac7706b80c8225b04a7eb3c7fcd7a9b404578f9e 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 8/8] Use stdbool.h if available

While we could do without this, extension code and third-party headers
are increasingly pulling this in, creating possible complications.  One,
bool defined in stdbool.h is not necessarily one byte in size.  Two, it
can only contain values 0 or 1 on output.  So having multiple
definitions of bool in play depending on include file order could create
a mess.

So we just get on board with this and use stdbool.h always if available.

As a benefit, some recent compilers can give some better warnings if the
official bool type is used.
---
 configure                  | 210 ++++++++++++++++++++++++++++++++++++---------
 configure.in               |   4 +
 src/include/c.h            |  23 ++---
 src/include/pg_config.h.in |   9 ++
 src/pl/plperl/plperl.h     |  10 +--
 5 files changed, 200 insertions(+), 56 deletions(-)

diff --git a/configure b/configure
index a2f9a256b4..e7b74adb13 100755
--- a/configure
+++ b/configure
@@ -2001,116 +2001,116 @@ $as_echo "$ac_res" >&6; }
 
 } # ac_fn_c_check_func
 
-# ac_fn_c_check_member LINENO AGGR MEMBER VAR INCLUDES
-# ----------------------------------------------------
-# Tries to find if the field MEMBER exists in type AGGR, after including
-# INCLUDES, setting cache variable VAR accordingly.
-ac_fn_c_check_member ()
+# ac_fn_c_check_type LINENO TYPE VAR INCLUDES
+# -------------------------------------------
+# Tests whether TYPE exists after having included INCLUDES, setting cache
+# variable VAR accordingly.
+ac_fn_c_check_type ()
 {
   as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack
-  { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $2.$3" >&5
-$as_echo_n "checking for $2.$3... " >&6; }
-if eval \${$4+:} false; then :
+  { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $2" >&5
+$as_echo_n "checking for $2... " >&6; }
+if eval \${$3+:} false; then :
   $as_echo_n "(cached) " >&6
 else
+  eval "$3=no"
   cat confdefs.h - <<_ACEOF >conftest.$ac_ext
 /* end confdefs.h.  */
-$5
+$4
 int
 main ()
 {
-static $2 ac_aggr;
-if (ac_aggr.$3)
-return 0;
+if (sizeof ($2))
+	 return 0;
   ;
   return 0;
 }
 _ACEOF
 if ac_fn_c_try_compile "$LINENO"; then :
-  eval "$4=yes"
-else
   cat confdefs.h - <<_ACEOF >conftest.$ac_ext
 /* end confdefs.h.  */
-$5
+$4
 int
 main ()
 {
-static $2 ac_aggr;
-if (sizeof ac_aggr.$3)
-return 0;
+if (sizeof (($2)))
+	    return 0;
   ;
   return 0;
 }
 _ACEOF
 if ac_fn_c_try_compile "$LINENO"; then :
-  eval "$4=yes"
+
 else
-  eval "$4=no"
+  eval "$3=yes"
 fi
 rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
 fi
 rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
 fi
-eval ac_res=\$$4
+eval ac_res=\$$3
 	       { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5
 $as_echo "$ac_res" >&6; }
   eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno
 
-} # ac_fn_c_check_member
+} # ac_fn_c_check_type
 
-# ac_fn_c_check_type LINENO TYPE VAR INCLUDES
-# -------------------------------------------
-# Tests whether TYPE exists after having included INCLUDES, setting cache
-# variable VAR accordingly.
-ac_fn_c_check_type ()
+# ac_fn_c_check_member LINENO AGGR MEMBER VAR INCLUDES
+# ----------------------------------------------------
+# Tries to find if the field MEMBER exists in type AGGR, after including
+# INCLUDES, setting cache variable VAR accordingly.
+ac_fn_c_check_member ()
 {
   as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack
-  { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $2" >&5
-$as_echo_n "checking for $2... " >&6; }
-if eval \${$3+:} false; then :
+  { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $2.$3" >&5
+$as_echo_n "checking for $2.$3... " >&6; }
+if eval \${$4+:} false; then :
   $as_echo_n "(cached) " >&6
 else
-  eval "$3=no"
   cat confdefs.h - <<_ACEOF >conftest.$ac_ext
 /* end confdefs.h.  */
-$4
+$5
 int
 main ()
 {
-if (sizeof ($2))
-	 return 0;
+static $2 ac_aggr;
+if (ac_aggr.$3)
+return 0;
   ;
   return 0;
 }
 _ACEOF
 if ac_fn_c_try_compile "$LINENO"; then :
+  eval "$4=yes"
+else
   cat confdefs.h - <<_ACEOF >conftest.$ac_ext
 /* end confdefs.h.  */
-$4
+$5
 int
 main ()
 {
-if (sizeof (($2)))
-	    return 0;
+static $2 ac_aggr;
+if (sizeof ac_aggr.$3)
+return 0;
   ;
   return 0;
 }
 _ACEOF
 if ac_fn_c_try_compile "$LINENO"; then :
-
+  eval "$4=yes"
 else
-  eval "$3=yes"
+  eval "$4=no"
 fi
 rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
 fi
 rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
 fi
-eval ac_res=\$$3
+eval ac_res=\$$4
 	       { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5
 $as_echo "$ac_res" >&6; }
   eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno
 
-} # ac_fn_c_check_type
+} # ac_fn_c_check_member
 
 # ac_fn_c_compute_int LINENO EXPR VAR INCLUDES
 # --------------------------------------------
@@ -10732,6 +10732,100 @@ fi
 ## Header files
 ##
 
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for stdbool.h that conforms to C99" >&5
+$as_echo_n "checking for stdbool.h that conforms to C99... " >&6; }
+if ${ac_cv_header_stdbool_h+:} false; then :
+  $as_echo_n "(cached) " >&6
+else
+  cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h.  */
+
+             #include <stdbool.h>
+             #ifndef bool
+              "error: bool is not defined"
+             #endif
+             #ifndef false
+              "error: false is not defined"
+             #endif
+             #if false
+              "error: false is not 0"
+             #endif
+             #ifndef true
+              "error: true is not defined"
+             #endif
+             #if true != 1
+              "error: true is not 1"
+             #endif
+             #ifndef __bool_true_false_are_defined
+              "error: __bool_true_false_are_defined is not defined"
+             #endif
+
+             struct s { _Bool s: 1; _Bool t; } s;
+
+             char a[true == 1 ? 1 : -1];
+             char b[false == 0 ? 1 : -1];
+             char c[__bool_true_false_are_defined == 1 ? 1 : -1];
+             char d[(bool) 0.5 == true ? 1 : -1];
+             /* See body of main program for 'e'.  */
+             char f[(_Bool) 0.0 == false ? 1 : -1];
+             char g[true];
+             char h[sizeof (_Bool)];
+             char i[sizeof s.t];
+             enum { j = false, k = true, l = false * true, m = true * 256 };
+             /* The following fails for
+                HP aC++/ANSI C B3910B A.05.55 [Dec 04 2003]. */
+             _Bool n[m];
+             char o[sizeof n == m * sizeof n[0] ? 1 : -1];
+             char p[-1 - (_Bool) 0 < 0 && -1 - (bool) 0 < 0 ? 1 : -1];
+             /* Catch a bug in an HP-UX C compiler.  See
+                http://gcc.gnu.org/ml/gcc-patches/2003-12/msg02303.html
+                http://lists.gnu.org/archive/html/bug-coreutils/2005-11/msg00161.html
+              */
+             _Bool q = true;
+             _Bool *pq = &q;
+
+int
+main ()
+{
+
+             bool e = &s;
+             *pq |= q;
+             *pq |= ! q;
+             /* Refer to every declared value, to avoid compiler optimizations.  */
+             return (!a + !b + !c + !d + !e + !f + !g + !h + !i + !!j + !k + !!l
+                     + !m + !n + !o + !p + !q + !pq);
+
+  ;
+  return 0;
+}
+_ACEOF
+if ac_fn_c_try_compile "$LINENO"; then :
+  ac_cv_header_stdbool_h=yes
+else
+  ac_cv_header_stdbool_h=no
+fi
+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_header_stdbool_h" >&5
+$as_echo "$ac_cv_header_stdbool_h" >&6; }
+   ac_fn_c_check_type "$LINENO" "_Bool" "ac_cv_type__Bool" "$ac_includes_default"
+if test "x$ac_cv_type__Bool" = xyes; then :
+
+cat >>confdefs.h <<_ACEOF
+#define HAVE__BOOL 1
+_ACEOF
+
+
+fi
+
+
+if test $ac_cv_header_stdbool_h = yes; then
+
+$as_echo "#define HAVE_STDBOOL_H 1" >>confdefs.h
+
+fi
+
+
 for ac_header in atomic.h crypt.h dld.h fp_class.h getopt.h ieeefp.h ifaddrs.h langinfo.h mbarrier.h poll.h sys/epoll.h sys/ipc.h sys/pstat.h sys/resource.h sys/select.h sys/sem.h sys/shm.h sys/sockio.h sys/tas.h sys/un.h termios.h ucred.h utime.h wchar.h wctype.h
 do :
   as_ac_Header=`$as_echo "ac_cv_header_$ac_header" | $as_tr_sh`
@@ -12818,6 +12912,40 @@ if test "$ac_cv_sizeof_off_t" -lt 8 -a "$segsize" != "1"; then
    as_fn_error $? "Large file support is not enabled. Segment size cannot be larger than 1GB." "$LINENO" 5
 fi
 
+# The cast to long int works around a bug in the HP C Compiler
+# version HP92453-01 B.11.11.23709.GP, which incorrectly rejects
+# declarations like `int a3[[(sizeof (unsigned char)) >= 0]];'.
+# This bug is HP SR number 8606223364.
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking size of _Bool" >&5
+$as_echo_n "checking size of _Bool... " >&6; }
+if ${ac_cv_sizeof__Bool+:} false; then :
+  $as_echo_n "(cached) " >&6
+else
+  if ac_fn_c_compute_int "$LINENO" "(long int) (sizeof (_Bool))" "ac_cv_sizeof__Bool"        "$ac_includes_default"; then :
+
+else
+  if test "$ac_cv_type__Bool" = yes; then
+     { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5
+$as_echo "$as_me: error: in \`$ac_pwd':" >&2;}
+as_fn_error 77 "cannot compute sizeof (_Bool)
+See \`config.log' for more details" "$LINENO" 5; }
+   else
+     ac_cv_sizeof__Bool=0
+   fi
+fi
+
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_sizeof__Bool" >&5
+$as_echo "$ac_cv_sizeof__Bool" >&6; }
+
+
+
+cat >>confdefs.h <<_ACEOF
+#define SIZEOF__BOOL $ac_cv_sizeof__Bool
+_ACEOF
+
+
+
 
 ##
 ## Functions, global variables
diff --git a/configure.in b/configure.in
index e94fba5235..0700ec8fb3 100644
--- a/configure.in
+++ b/configure.in
@@ -1180,6 +1180,8 @@ AC_SUBST(UUID_LIBS)
 ## Header files
 ##
 
+AC_HEADER_STDBOOL
+
 AC_CHECK_HEADERS([atomic.h crypt.h dld.h fp_class.h getopt.h ieeefp.h ifaddrs.h langinfo.h mbarrier.h poll.h sys/epoll.h sys/ipc.h sys/pstat.h sys/resource.h sys/select.h sys/sem.h sys/shm.h sys/sockio.h sys/tas.h sys/un.h termios.h ucred.h utime.h wchar.h wctype.h])
 
 # On BSD, test for net/if.h will fail unless sys/socket.h
@@ -1413,6 +1415,8 @@ if test "$ac_cv_sizeof_off_t" -lt 8 -a "$segsize" != "1"; then
    AC_MSG_ERROR([Large file support is not enabled. Segment size cannot be larger than 1GB.])
 fi
 
+AC_CHECK_SIZEOF(_Bool)
+
 
 ##
 ## Functions, global variables
diff --git a/src/include/c.h b/src/include/c.h
index 28f8d2bf75..7320c9d796 100644
--- a/src/include/c.h
+++ b/src/include/c.h
@@ -192,24 +192,27 @@
  * bool
  *		Boolean value, either true or false.
  *
- * XXX for C++ compilers, we assume the compiler has a compatible
+ * Use stdbool.h if available, to ensure best compatibility with third-party
+ * libraries.  For C++ compilers, we assume the compiler has a compatible
  * built-in definition of bool.
  */
 
 #ifndef __cplusplus
 
-#ifndef bool
-typedef char bool;
-#define SIZEOF_BOOL 1
+#ifdef HAVE_STDBOOL_H
+#include <stdbool.h>
+#else
+#ifndef HAVE__BOOL
+#define _Bool signed char
+#define SIZEOF__BOOL 1
 #endif
-
-#ifndef true
-#define true	((bool) 1)
+#define bool _Bool
+#define false 0
+#define true 1
 #endif
 
-#ifndef false
-#define false	((bool) 0)
-#endif
+#define SIZEOF_BOOL SIZEOF__BOOL
+
 #endif							/* not C++ */
 
 /*
diff --git a/src/include/pg_config.h.in b/src/include/pg_config.h.in
index dcb7a1a320..2d39812ea2 100644
--- a/src/include/pg_config.h.in
+++ b/src/include/pg_config.h.in
@@ -473,6 +473,9 @@
 /* Define to 1 if you have the `SSL_get_current_compression' function. */
 #undef HAVE_SSL_GET_CURRENT_COMPRESSION
 
+/* Define to 1 if stdbool.h conforms to C99. */
+#undef HAVE_STDBOOL_H
+
 /* Define to 1 if you have the <stdint.h> header file. */
 #undef HAVE_STDINT_H
 
@@ -675,6 +678,9 @@
 /* Define to 1 if you have the <winldap.h> header file. */
 #undef HAVE_WINLDAP_H
 
+/* Define to 1 if the system has the type `_Bool'. */
+#undef HAVE__BOOL
+
 /* Define to 1 if your compiler understands __builtin_bswap32. */
 #undef HAVE__BUILTIN_BSWAP32
 
@@ -790,6 +796,9 @@
 /* The size of `void *', as computed by sizeof. */
 #undef SIZEOF_VOID_P
 
+/* The size of `_Bool', as computed by sizeof. */
+#undef SIZEOF__BOOL
+
 /* Define to 1 if you have the ANSI C header files. */
 #undef STDC_HEADERS
 
diff --git a/src/pl/plperl/plperl.h b/src/pl/plperl/plperl.h
index c4e06d089f..f144813e94 100644
--- a/src/pl/plperl/plperl.h
+++ b/src/pl/plperl/plperl.h
@@ -42,6 +42,11 @@
 #undef vsnprintf
 #endif
 
+/*
+ * Prevent perl from redefining "bool".
+ */
+#define HAS_BOOL 1
+
 
 /*
  * Get the basic Perl API.  We use PERL_NO_GET_CONTEXT mode so that our code
@@ -83,11 +88,6 @@
 #define NEED_sv_2pv_flags
 #include "ppport.h"
 
-/* perl may have a different width of "bool", don't buy it */
-#ifdef bool
-#undef bool
-#endif
-
 /* supply HeUTF8 if it's missing - ppport.h doesn't supply it, unfortunately */
 #ifndef HeUTF8
 #define HeUTF8(he)			   ((HeKLEN(he) == HEf_SVKEY) ?			   \
-- 
2.14.1



-- 
Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-hackers

Attachments:

0001-Fix-bool-int-type-confusion.patch (text/plain, 763B) download From 34273524912be24a42d2fc0f9c5f24f55052b089 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 1/8] Fix bool/int type confusion Using ++ on a bool variable doesn't work well when stdbool.h is in use. The original BSD code appears to use int here, so use that instead. --- src/timezone/localtime.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/timezone/localtime.c b/src/timezone/localtime.c index 08642d1236..82c18e8544 100644 --- a/src/timezone/localtime.c +++ b/src/timezone/localtime.c @@ -1379,7 +1379,7 @@ timesub(const pg_time_t *timep, int32 offset, int y; const int *ip; int64 corr; - bool hit; + int hit; int i; corr = 0; -- 2.14.1
0002-Change-TRUE-FALSE-to-true-false.patch (text/plain, 177.3K) download From fe86c67cd3f4db3410bea4f72abed1d79f93792d 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 2/8] Change TRUE/FALSE to true/false The lower case spellings are C and C++ standard and are used in most parts of the PostgreSQL sources. The upper case spellings are only used in some files/modules. So standardize on the standard spellings. --- contrib/btree_gist/btree_bit.c | 6 +- contrib/btree_gist/btree_bytea.c | 2 +- contrib/btree_gist/btree_inet.c | 2 +- contrib/btree_gist/btree_interval.c | 4 +- contrib/btree_gist/btree_numeric.c | 2 +- contrib/btree_gist/btree_text.c | 4 +- contrib/btree_gist/btree_time.c | 2 +- contrib/btree_gist/btree_ts.c | 2 +- contrib/btree_gist/btree_utils_num.c | 4 +- contrib/btree_gist/btree_utils_var.c | 12 +- contrib/btree_gist/btree_uuid.c | 2 +- contrib/cube/cube.c | 36 ++--- contrib/dblink/dblink.c | 6 +- contrib/fuzzystrmatch/fuzzystrmatch.c | 8 +- contrib/hstore/hstore_gist.c | 10 +- contrib/intarray/_int_bool.c | 2 +- contrib/intarray/_int_gin.c | 14 +- contrib/intarray/_int_gist.c | 18 +-- contrib/intarray/_int_op.c | 8 +- contrib/intarray/_int_tool.c | 6 +- contrib/intarray/_intbig_gist.c | 6 +- contrib/ltree/_ltree_gist.c | 4 +- contrib/ltree/ltree_gist.c | 4 +- contrib/pg_trgm/trgm_gist.c | 4 +- contrib/seg/seg.c | 10 +- doc/src/sgml/gin.sgml | 28 ++-- doc/src/sgml/indexam.sgml | 26 +-- doc/src/sgml/libpq.sgml | 4 +- doc/src/sgml/spgist.sgml | 2 +- doc/src/sgml/sslinfo.sgml | 6 +- src/backend/access/gin/ginbtree.c | 4 +- src/backend/access/gin/ginbulk.c | 6 +- src/backend/access/gin/gindatapage.c | 14 +- src/backend/access/gin/ginentrypage.c | 16 +- src/backend/access/gin/ginget.c | 40 ++--- src/backend/access/gin/gininsert.c | 4 +- src/backend/access/gin/ginvacuum.c | 32 ++-- src/backend/access/gist/gist.c | 4 +- src/backend/access/gist/gistget.c | 4 +- src/backend/access/gist/gistproc.c | 16 +- src/backend/access/gist/gistsplit.c | 38 ++--- src/backend/access/gist/gistutil.c | 24 +-- src/backend/commands/tablecmds.c | 14 +- src/backend/executor/nodeAgg.c | 2 +- src/backend/executor/nodeAppend.c | 8 +- src/backend/executor/nodeGroup.c | 8 +- src/backend/optimizer/util/predtest.c | 42 ++--- src/backend/parser/gram.y | 294 +++++++++++++++++----------------- src/backend/parser/parse_utilcmd.c | 8 +- src/backend/replication/repl_gram.y | 18 +-- src/backend/storage/buffer/bufmgr.c | 26 +-- src/backend/storage/buffer/localbuf.c | 6 +- src/backend/storage/ipc/shmem.c | 8 +- src/backend/storage/ipc/shmqueue.c | 8 +- src/backend/storage/lmgr/lock.c | 26 +-- src/backend/utils/adt/datetime.c | 50 +++--- src/backend/utils/adt/formatting.c | 272 +++++++++++++++---------------- src/backend/utils/adt/geo_ops.c | 12 +- src/backend/utils/adt/network_gist.c | 6 +- src/backend/utils/adt/numeric.c | 10 +- src/backend/utils/adt/tsginidx.c | 2 +- src/backend/utils/adt/tsgistidx.c | 6 +- src/backend/utils/adt/tsquery_gist.c | 4 +- src/backend/utils/misc/guc.c | 18 +-- src/interfaces/ecpg/preproc/pgc.l | 24 +-- src/interfaces/libpq/fe-connect.c | 28 ++-- src/interfaces/libpq/fe-exec.c | 86 +++++----- src/interfaces/libpq/fe-misc.c | 2 +- src/interfaces/libpq/fe-protocol2.c | 12 +- src/interfaces/libpq/fe-protocol3.c | 12 +- src/interfaces/libpq/libpq-events.c | 34 ++-- src/pl/plpgsql/src/pl_exec.c | 8 +- 72 files changed, 750 insertions(+), 750 deletions(-) diff --git a/contrib/btree_gist/btree_bit.c b/contrib/btree_gist/btree_bit.c index a56a2752a7..2225244ded 100644 --- a/contrib/btree_gist/btree_bit.c +++ b/contrib/btree_gist/btree_bit.c @@ -111,7 +111,7 @@ static const gbtree_vinfo tinfo = { gbt_t_bit, 0, - TRUE, + true, gbt_bitgt, gbt_bitge, gbt_biteq, @@ -152,13 +152,13 @@ gbt_bit_consistent(PG_FUNCTION_ARGS) if (GIST_LEAF(entry)) retval = gbt_var_consistent(&r, query, strategy, PG_GET_COLLATION(), - TRUE, &tinfo, fcinfo->flinfo); + true, &tinfo, fcinfo->flinfo); else { bytea *q = gbt_bit_xfrm((bytea *) query); retval = gbt_var_consistent(&r, q, strategy, PG_GET_COLLATION(), - FALSE, &tinfo, fcinfo->flinfo); + false, &tinfo, fcinfo->flinfo); } PG_RETURN_BOOL(retval); } diff --git a/contrib/btree_gist/btree_bytea.c b/contrib/btree_gist/btree_bytea.c index 00753e7f48..6b005f0157 100644 --- a/contrib/btree_gist/btree_bytea.c +++ b/contrib/btree_gist/btree_bytea.c @@ -75,7 +75,7 @@ static const gbtree_vinfo tinfo = { gbt_t_bytea, 0, - TRUE, + true, gbt_byteagt, gbt_byteage, gbt_byteaeq, diff --git a/contrib/btree_gist/btree_inet.c b/contrib/btree_gist/btree_inet.c index b5b593f77f..86c27ca955 100644 --- a/contrib/btree_gist/btree_inet.c +++ b/contrib/btree_gist/btree_inet.c @@ -105,7 +105,7 @@ gbt_inet_compress(PG_FUNCTION_ARGS) r->upper = r->lower; gistentryinit(*retval, PointerGetDatum(r), entry->rel, entry->page, - entry->offset, FALSE); + entry->offset, false); } else retval = entry; diff --git a/contrib/btree_gist/btree_interval.c b/contrib/btree_gist/btree_interval.c index 61ab478c42..3a527a75fa 100644 --- a/contrib/btree_gist/btree_interval.c +++ b/contrib/btree_gist/btree_interval.c @@ -169,7 +169,7 @@ gbt_intv_compress(PG_FUNCTION_ARGS) } gistentryinit(*retval, PointerGetDatum(r), entry->rel, entry->page, - entry->offset, FALSE); + entry->offset, false); } PG_RETURN_POINTER(retval); @@ -201,7 +201,7 @@ gbt_intv_decompress(PG_FUNCTION_ARGS) gistentryinit(*retval, PointerGetDatum(r), entry->rel, entry->page, - entry->offset, FALSE); + entry->offset, false); } PG_RETURN_POINTER(retval); } diff --git a/contrib/btree_gist/btree_numeric.c b/contrib/btree_gist/btree_numeric.c index 43793d36a2..b72060cdb6 100644 --- a/contrib/btree_gist/btree_numeric.c +++ b/contrib/btree_gist/btree_numeric.c @@ -79,7 +79,7 @@ static const gbtree_vinfo tinfo = { gbt_t_numeric, 0, - FALSE, + false, gbt_numeric_gt, gbt_numeric_ge, gbt_numeric_eq, diff --git a/contrib/btree_gist/btree_text.c b/contrib/btree_gist/btree_text.c index 090c849470..79ffac2685 100644 --- a/contrib/btree_gist/btree_text.c +++ b/contrib/btree_gist/btree_text.c @@ -80,7 +80,7 @@ static gbtree_vinfo tinfo = { gbt_t_text, 0, - FALSE, + false, gbt_textgt, gbt_textge, gbt_texteq, @@ -128,7 +128,7 @@ gbt_bpchar_compress(PG_FUNCTION_ARGS) gistentryinit(trim, d, entry->rel, entry->page, - entry->offset, TRUE); + entry->offset, true); retval = gbt_var_compress(&trim, &tinfo); } else diff --git a/contrib/btree_gist/btree_time.c b/contrib/btree_gist/btree_time.c index bb239d4986..90cf6554ea 100644 --- a/contrib/btree_gist/btree_time.c +++ b/contrib/btree_gist/btree_time.c @@ -183,7 +183,7 @@ gbt_timetz_compress(PG_FUNCTION_ARGS) r->lower = r->upper = tmp; gistentryinit(*retval, PointerGetDatum(r), entry->rel, entry->page, - entry->offset, FALSE); + entry->offset, false); } else retval = entry; diff --git a/contrib/btree_gist/btree_ts.c b/contrib/btree_gist/btree_ts.c index 1582cff102..18740cad38 100644 --- a/contrib/btree_gist/btree_ts.c +++ b/contrib/btree_gist/btree_ts.c @@ -230,7 +230,7 @@ gbt_tstz_compress(PG_FUNCTION_ARGS) r->lower = r->upper = gmt; gistentryinit(*retval, PointerGetDatum(r), entry->rel, entry->page, - entry->offset, FALSE); + entry->offset, false); } else retval = entry; diff --git a/contrib/btree_gist/btree_utils_num.c b/contrib/btree_gist/btree_utils_num.c index bae32c4064..3b77d22b4b 100644 --- a/contrib/btree_gist/btree_utils_num.c +++ b/contrib/btree_gist/btree_utils_num.c @@ -86,7 +86,7 @@ gbt_num_compress(GISTENTRY *entry, const gbtree_ninfo *tinfo) memcpy((void *) &r[tinfo->size], leaf, tinfo->size); retval = palloc(sizeof(GISTENTRY)); gistentryinit(*retval, PointerGetDatum(r), entry->rel, entry->page, - entry->offset, FALSE); + entry->offset, false); } else retval = entry; @@ -150,7 +150,7 @@ gbt_num_fetch(GISTENTRY *entry, const gbtree_ninfo *tinfo) retval = palloc(sizeof(GISTENTRY)); gistentryinit(*retval, datum, entry->rel, entry->page, entry->offset, - FALSE); + false); return retval; } diff --git a/contrib/btree_gist/btree_utils_var.c b/contrib/btree_gist/btree_utils_var.c index 2c636ad2fa..a7d7597d7a 100644 --- a/contrib/btree_gist/btree_utils_var.c +++ b/contrib/btree_gist/btree_utils_var.c @@ -45,7 +45,7 @@ gbt_var_decompress(PG_FUNCTION_ARGS) gistentryinit(*retval, PointerGetDatum(key), entry->rel, entry->page, - entry->offset, FALSE); + entry->offset, false); PG_RETURN_POINTER(retval); } @@ -169,7 +169,7 @@ gbt_var_node_cp_len(const GBT_VARKEY *node, const gbtree_vinfo *tinfo) static bool gbt_bytea_pf_match(const bytea *pf, const bytea *query, const gbtree_vinfo *tinfo) { - bool out = FALSE; + bool out = false; int32 qlen = VARSIZE(query) - VARHDRSZ; int32 nlen = VARSIZE(pf) - VARHDRSZ; @@ -294,7 +294,7 @@ gbt_var_compress(GISTENTRY *entry, const gbtree_vinfo *tinfo) retval = palloc(sizeof(GISTENTRY)); gistentryinit(*retval, PointerGetDatum(r), entry->rel, entry->page, - entry->offset, TRUE); + entry->offset, true); } else retval = entry; @@ -314,7 +314,7 @@ gbt_var_fetch(PG_FUNCTION_ARGS) retval = palloc(sizeof(GISTENTRY)); gistentryinit(*retval, PointerGetDatum(r.lower), entry->rel, entry->page, - entry->offset, TRUE); + entry->offset, true); PG_RETURN_POINTER(retval); } @@ -561,7 +561,7 @@ gbt_var_consistent(GBT_VARKEY_R *key, const gbtree_vinfo *tinfo, FmgrInfo *flinfo) { - bool retval = FALSE; + bool retval = false; switch (strategy) { @@ -607,7 +607,7 @@ gbt_var_consistent(GBT_VARKEY_R *key, (*tinfo->f_eq) (query, key->upper, collation, flinfo)); break; default: - retval = FALSE; + retval = false; } return retval; diff --git a/contrib/btree_gist/btree_uuid.c b/contrib/btree_gist/btree_uuid.c index ecf357d662..bbed16a852 100644 --- a/contrib/btree_gist/btree_uuid.c +++ b/contrib/btree_gist/btree_uuid.c @@ -114,7 +114,7 @@ gbt_uuid_compress(PG_FUNCTION_ARGS) memcpy((void *) (r + UUID_LEN), (void *) key, UUID_LEN); gistentryinit(*retval, PointerGetDatum(r), entry->rel, entry->page, - entry->offset, FALSE); + entry->offset, false); } else retval = entry; diff --git a/contrib/cube/cube.c b/contrib/cube/cube.c index 149558c763..6ab3a15bc8 100644 --- a/contrib/cube/cube.c +++ b/contrib/cube/cube.c @@ -309,7 +309,7 @@ cube_out(PG_FUNCTION_ARGS) /* ** The GiST Consistent method for boxes ** Should return false if for all data items x below entry, -** the predicate x op query == FALSE, where op is the oper +** the predicate x op query == false, where op is the oper ** corresponding to strategy in the pg_amop table. */ Datum @@ -396,7 +396,7 @@ g_cube_decompress(PG_FUNCTION_ARGS) gistentryinit(*retval, PointerGetDatum(key), entry->rel, entry->page, - entry->offset, FALSE); + entry->offset, false); PG_RETURN_POINTER(retval); } PG_RETURN_POINTER(entry); @@ -589,9 +589,9 @@ g_cube_same(PG_FUNCTION_ARGS) bool *result = (bool *) PG_GETARG_POINTER(2); if (cube_cmp_v0(b1, b2) == 0) - *result = TRUE; + *result = true; else - *result = FALSE; + *result = false; PG_RETURN_NDBOX(result); } @@ -623,7 +623,7 @@ g_cube_leaf_consistent(NDBOX *key, retval = (bool) cube_contains_v0(query, key); break; default: - retval = FALSE; + retval = false; } return (retval); } @@ -650,7 +650,7 @@ g_cube_internal_consistent(NDBOX *key, retval = (bool) cube_overlap_v0(key, query); break; default: - retval = FALSE; + retval = false; } return (retval); } @@ -1058,7 +1058,7 @@ cube_contains_v0(NDBOX *a, NDBOX *b) int i; if ((a == NULL) || (b == NULL)) - return (FALSE); + return (false); if (DIM(a) < DIM(b)) { @@ -1070,9 +1070,9 @@ cube_contains_v0(NDBOX *a, NDBOX *b) for (i = DIM(a); i < DIM(b); i++) { if (LL_COORD(b, i) != 0) - return (FALSE); + return (false); if (UR_COORD(b, i) != 0) - return (FALSE); + return (false); } } @@ -1081,13 +1081,13 @@ cube_contains_v0(NDBOX *a, NDBOX *b) { if (Min(LL_COORD(a, i), UR_COORD(a, i)) > Min(LL_COORD(b, i), UR_COORD(b, i))) - return (FALSE); + return (false); if (Max(LL_COORD(a, i), UR_COORD(a, i)) < Max(LL_COORD(b, i), UR_COORD(b, i))) - return (FALSE); + return (false); } - return (TRUE); + return (true); } Datum @@ -1128,7 +1128,7 @@ cube_overlap_v0(NDBOX *a, NDBOX *b) int i; if ((a == NULL) || (b == NULL)) - return (FALSE); + return (false); /* swap the box pointers if needed */ if (DIM(a) < DIM(b)) @@ -1143,21 +1143,21 @@ cube_overlap_v0(NDBOX *a, NDBOX *b) for (i = 0; i < DIM(b); i++) { if (Min(LL_COORD(a, i), UR_COORD(a, i)) > Max(LL_COORD(b, i), UR_COORD(b, i))) - return (FALSE); + return (false); if (Max(LL_COORD(a, i), UR_COORD(a, i)) < Min(LL_COORD(b, i), UR_COORD(b, i))) - return (FALSE); + return (false); } /* compare to zero those dimensions in (a) absent in (b) */ for (i = DIM(b); i < DIM(a); i++) { if (Min(LL_COORD(a, i), UR_COORD(a, i)) > 0) - return (FALSE); + return (false); if (Max(LL_COORD(a, i), UR_COORD(a, i)) < 0) - return (FALSE); + return (false); } - return (TRUE); + return (true); } diff --git a/contrib/dblink/dblink.c b/contrib/dblink/dblink.c index 81136b131c..c90717e678 100644 --- a/contrib/dblink/dblink.c +++ b/contrib/dblink/dblink.c @@ -243,7 +243,7 @@ dblink_init(void) pconn = (remoteConn *) MemoryContextAlloc(TopMemoryContext, sizeof(remoteConn)); pconn->conn = NULL; pconn->openCursorCount = 0; - pconn->newXactForCursor = FALSE; + pconn->newXactForCursor = false; } } @@ -423,7 +423,7 @@ dblink_open(PG_FUNCTION_ARGS) if (PQresultStatus(res) != PGRES_COMMAND_OK) dblink_res_internalerror(conn, res, "begin error"); PQclear(res); - rconn->newXactForCursor = TRUE; + rconn->newXactForCursor = true; /* * Since transaction state was IDLE, we force cursor count to @@ -523,7 +523,7 @@ dblink_close(PG_FUNCTION_ARGS) /* if count is zero, commit the transaction */ if (rconn->openCursorCount == 0) { - rconn->newXactForCursor = FALSE; + rconn->newXactForCursor = false; res = PQexec(conn, "COMMIT"); if (PQresultStatus(res) != PGRES_COMMAND_OK) diff --git a/contrib/fuzzystrmatch/fuzzystrmatch.c b/contrib/fuzzystrmatch/fuzzystrmatch.c index ce58a6a7fc..25c6ce465c 100644 --- a/contrib/fuzzystrmatch/fuzzystrmatch.c +++ b/contrib/fuzzystrmatch/fuzzystrmatch.c @@ -87,7 +87,7 @@ soundex_code(char letter) phoned_word -- The final phonized word. (We'll allocate the memory.) Output - error -- A simple error flag, returns TRUE or FALSE + error -- A simple error flag, returns true or false NOTES: ALL non-alpha characters are ignored, this includes whitespace, although non-alpha characters will break up phonemes. @@ -101,9 +101,9 @@ soundex_code(char letter) ***************************************************************************/ -#define META_ERROR FALSE -#define META_SUCCESS TRUE -#define META_FAILURE FALSE +#define META_ERROR false +#define META_SUCCESS true +#define META_FAILURE false /* I add modifications to the traditional metaphone algorithm that you diff --git a/contrib/hstore/hstore_gist.c b/contrib/hstore/hstore_gist.c index f8f5934e40..c8fc1f9d9e 100644 --- a/contrib/hstore/hstore_gist.c +++ b/contrib/hstore/hstore_gist.c @@ -144,7 +144,7 @@ ghstore_compress(PG_FUNCTION_ARGS) gistentryinit(*retval, PointerGetDatum(res), entry->rel, entry->page, entry->offset, - FALSE); + false); } else if (!ISALLTRUE(DatumGetPointer(entry->key))) { @@ -166,7 +166,7 @@ ghstore_compress(PG_FUNCTION_ARGS) gistentryinit(*retval, PointerGetDatum(res), entry->rel, entry->page, entry->offset, - FALSE); + false); } PG_RETURN_POINTER(retval); @@ -570,7 +570,7 @@ ghstore_consistent(PG_FUNCTION_ARGS) continue; crc = crc32_sz(VARDATA(key_datums[i]), VARSIZE(key_datums[i]) - VARHDRSZ); if (!(GETBIT(sign, HASHVAL(crc)))) - res = FALSE; + res = false; } } else if (strategy == HStoreExistsAnyStrategyNumber) @@ -585,7 +585,7 @@ ghstore_consistent(PG_FUNCTION_ARGS) TEXTOID, -1, false, 'i', &key_datums, &key_nulls, &key_count); - res = FALSE; + res = false; for (i = 0; !res && i < key_count; ++i) { @@ -595,7 +595,7 @@ ghstore_consistent(PG_FUNCTION_ARGS) continue; crc = crc32_sz(VARDATA(key_datums[i]), VARSIZE(key_datums[i]) - VARHDRSZ); if (GETBIT(sign, HASHVAL(crc))) - res = TRUE; + res = true; } } else diff --git a/contrib/intarray/_int_bool.c b/contrib/intarray/_int_bool.c index a18c645606..5856ca1dba 100644 --- a/contrib/intarray/_int_bool.c +++ b/contrib/intarray/_int_bool.c @@ -342,7 +342,7 @@ gin_bool_consistent(QUERYTYPE *query, bool *check) j = 0; if (query->size <= 0) - return FALSE; + return false; /* * Set up data for checkcondition_gin. This must agree with the query diff --git a/contrib/intarray/_int_gin.c b/contrib/intarray/_int_gin.c index 73628bea11..7aebfec54b 100644 --- a/contrib/intarray/_int_gin.c +++ b/contrib/intarray/_int_gin.c @@ -116,7 +116,7 @@ ginint4_consistent(PG_FUNCTION_ARGS) /* Pointer *extra_data = (Pointer *) PG_GETARG_POINTER(4); */ bool *recheck = (bool *) PG_GETARG_POINTER(5); - bool res = FALSE; + bool res = false; int32 i; switch (strategy) @@ -125,25 +125,25 @@ ginint4_consistent(PG_FUNCTION_ARGS) /* result is not lossy */ *recheck = false; /* at least one element in check[] is true, so result = true */ - res = TRUE; + res = true; break; case RTContainedByStrategyNumber: case RTOldContainedByStrategyNumber: /* we will need recheck */ *recheck = true; /* at least one element in check[] is true, so result = true */ - res = TRUE; + res = true; break; case RTSameStrategyNumber: /* we will need recheck */ *recheck = true; /* Must have all elements in check[] true */ - res = TRUE; + res = true; for (i = 0; i < nkeys; i++) { if (!check[i]) { - res = FALSE; + res = false; break; } } @@ -153,12 +153,12 @@ ginint4_consistent(PG_FUNCTION_ARGS) /* result is not lossy */ *recheck = false; /* Must have all elements in check[] true */ - res = TRUE; + res = true; for (i = 0; i < nkeys; i++) { if (!check[i]) { - res = FALSE; + res = false; break; } } diff --git a/contrib/intarray/_int_gist.c b/contrib/intarray/_int_gist.c index 79521b29b0..911d18023b 100644 --- a/contrib/intarray/_int_gist.c +++ b/contrib/intarray/_int_gist.c @@ -27,7 +27,7 @@ PG_FUNCTION_INFO_V1(g_int_same); /* ** The GiST Consistent method for _intments ** Should return false if for all data items x below entry, -** the predicate x op query == FALSE, where op is the oper +** the predicate x op query == false, where op is the oper ** corresponding to strategy in the pg_amop table. */ Datum @@ -89,7 +89,7 @@ g_int_consistent(PG_FUNCTION_ARGS) query); break; default: - retval = FALSE; + retval = false; } pfree(query); PG_RETURN_BOOL(retval); @@ -159,7 +159,7 @@ g_int_compress(PG_FUNCTION_ARGS) retval = palloc(sizeof(GISTENTRY)); gistentryinit(*retval, PointerGetDatum(r), - entry->rel, entry->page, entry->offset, FALSE); + entry->rel, entry->page, entry->offset, false); PG_RETURN_POINTER(retval); } @@ -206,7 +206,7 @@ g_int_compress(PG_FUNCTION_ARGS) r = resize_intArrayType(r, len); retval = palloc(sizeof(GISTENTRY)); gistentryinit(*retval, PointerGetDatum(r), - entry->rel, entry->page, entry->offset, FALSE); + entry->rel, entry->page, entry->offset, false); PG_RETURN_POINTER(retval); } else @@ -236,7 +236,7 @@ g_int_decompress(PG_FUNCTION_ARGS) { retval = palloc(sizeof(GISTENTRY)); gistentryinit(*retval, PointerGetDatum(in), - entry->rel, entry->page, entry->offset, FALSE); + entry->rel, entry->page, entry->offset, false); PG_RETURN_POINTER(retval); } @@ -251,7 +251,7 @@ g_int_decompress(PG_FUNCTION_ARGS) { retval = palloc(sizeof(GISTENTRY)); gistentryinit(*retval, PointerGetDatum(in), - entry->rel, entry->page, entry->offset, FALSE); + entry->rel, entry->page, entry->offset, false); PG_RETURN_POINTER(retval); } @@ -273,7 +273,7 @@ g_int_decompress(PG_FUNCTION_ARGS) pfree(in); retval = palloc(sizeof(GISTENTRY)); gistentryinit(*retval, PointerGetDatum(r), - entry->rel, entry->page, entry->offset, FALSE); + entry->rel, entry->page, entry->offset, false); PG_RETURN_POINTER(retval); } @@ -321,14 +321,14 @@ g_int_same(PG_FUNCTION_ARGS) *result = false; PG_RETURN_POINTER(result); } - *result = TRUE; + *result = true; da = ARRPTR(a); db = ARRPTR(b); while (n--) { if (*da++ != *db++) { - *result = FALSE; + *result = false; break; } } diff --git a/contrib/intarray/_int_op.c b/contrib/intarray/_int_op.c index 3637c4564c..fe7fcc4662 100644 --- a/contrib/intarray/_int_op.c +++ b/contrib/intarray/_int_op.c @@ -74,19 +74,19 @@ _int_same(PG_FUNCTION_ARGS) da = ARRPTR(a); db = ARRPTR(b); - result = FALSE; + result = false; if (na == nb) { SORT(a); SORT(b); - result = TRUE; + result = true; for (n = 0; n < na; n++) { if (da[n] != db[n]) { - result = FALSE; + result = false; break; } } @@ -110,7 +110,7 @@ _int_overlap(PG_FUNCTION_ARGS) CHECKARRVALID(a); CHECKARRVALID(b); if (ARRISEMPTY(a) || ARRISEMPTY(b)) - return FALSE; + return false; SORT(a); SORT(b); diff --git a/contrib/intarray/_int_tool.c b/contrib/intarray/_int_tool.c index 2fdfd2ec63..ee8fb64a47 100644 --- a/contrib/intarray/_int_tool.c +++ b/contrib/intarray/_int_tool.c @@ -40,7 +40,7 @@ inner_int_contains(ArrayType *a, ArrayType *b) break; /* db[j] is not in da */ } - return (n == nb) ? TRUE : FALSE; + return (n == nb) ? true : false; } /* arguments are assumed sorted */ @@ -65,12 +65,12 @@ inner_int_overlap(ArrayType *a, ArrayType *b) if (da[i] < db[j]) i++; else if (da[i] == db[j]) - return TRUE; + return true; else j++; } - return FALSE; + return false; } ArrayType * diff --git a/contrib/intarray/_intbig_gist.c b/contrib/intarray/_intbig_gist.c index 6dae7c91c1..de7bc82a23 100644 --- a/contrib/intarray/_intbig_gist.c +++ b/contrib/intarray/_intbig_gist.c @@ -168,7 +168,7 @@ g_intbig_compress(PG_FUNCTION_ARGS) retval = (GISTENTRY *) palloc(sizeof(GISTENTRY)); gistentryinit(*retval, PointerGetDatum(res), entry->rel, entry->page, - entry->offset, FALSE); + entry->offset, false); if (in != DatumGetArrayTypeP(entry->key)) pfree(in); @@ -195,7 +195,7 @@ g_intbig_compress(PG_FUNCTION_ARGS) retval = (GISTENTRY *) palloc(sizeof(GISTENTRY)); gistentryinit(*retval, PointerGetDatum(res), entry->rel, entry->page, - entry->offset, FALSE); + entry->offset, false); PG_RETURN_POINTER(retval); } @@ -594,7 +594,7 @@ g_intbig_consistent(PG_FUNCTION_ARGS) retval = _intbig_overlap((GISTTYPE *) DatumGetPointer(entry->key), query); break; default: - retval = FALSE; + retval = false; } PG_FREE_IF_COPY(query, 1); PG_RETURN_BOOL(retval); diff --git a/contrib/ltree/_ltree_gist.c b/contrib/ltree/_ltree_gist.c index a387f5b899..77efa2fdeb 100644 --- a/contrib/ltree/_ltree_gist.c +++ b/contrib/ltree/_ltree_gist.c @@ -100,7 +100,7 @@ _ltree_compress(PG_FUNCTION_ARGS) retval = (GISTENTRY *) palloc(sizeof(GISTENTRY)); gistentryinit(*retval, PointerGetDatum(key), entry->rel, entry->page, - entry->offset, FALSE); + entry->offset, false); } else if (!LTG_ISALLTRUE(entry->key)) { @@ -123,7 +123,7 @@ _ltree_compress(PG_FUNCTION_ARGS) retval = (GISTENTRY *) palloc(sizeof(GISTENTRY)); gistentryinit(*retval, PointerGetDatum(key), entry->rel, entry->page, - entry->offset, FALSE); + entry->offset, false); } PG_RETURN_POINTER(retval); } diff --git a/contrib/ltree/ltree_gist.c b/contrib/ltree/ltree_gist.c index 70e78a672a..86d50028bb 100644 --- a/contrib/ltree/ltree_gist.c +++ b/contrib/ltree/ltree_gist.c @@ -64,7 +64,7 @@ ltree_compress(PG_FUNCTION_ARGS) retval = (GISTENTRY *) palloc(sizeof(GISTENTRY)); gistentryinit(*retval, PointerGetDatum(key), entry->rel, entry->page, - entry->offset, FALSE); + entry->offset, false); } PG_RETURN_POINTER(retval); } @@ -81,7 +81,7 @@ ltree_decompress(PG_FUNCTION_ARGS) gistentryinit(*retval, PointerGetDatum(key), entry->rel, entry->page, - entry->offset, FALSE); + entry->offset, false); PG_RETURN_POINTER(retval); } PG_RETURN_POINTER(entry); diff --git a/contrib/pg_trgm/trgm_gist.c b/contrib/pg_trgm/trgm_gist.c index ed02af875c..e55dc19a65 100644 --- a/contrib/pg_trgm/trgm_gist.c +++ b/contrib/pg_trgm/trgm_gist.c @@ -106,7 +106,7 @@ gtrgm_compress(PG_FUNCTION_ARGS) retval = (GISTENTRY *) palloc(sizeof(GISTENTRY)); gistentryinit(*retval, PointerGetDatum(res), entry->rel, entry->page, - entry->offset, FALSE); + entry->offset, false); } else if (ISSIGNKEY(DatumGetPointer(entry->key)) && !ISALLTRUE(DatumGetPointer(entry->key))) @@ -130,7 +130,7 @@ gtrgm_compress(PG_FUNCTION_ARGS) retval = (GISTENTRY *) palloc(sizeof(GISTENTRY)); gistentryinit(*retval, PointerGetDatum(res), entry->rel, entry->page, - entry->offset, FALSE); + entry->offset, false); } PG_RETURN_POINTER(retval); } diff --git a/contrib/seg/seg.c b/contrib/seg/seg.c index 4fc18130e1..7b74fb9d84 100644 --- a/contrib/seg/seg.c +++ b/contrib/seg/seg.c @@ -188,7 +188,7 @@ seg_upper(PG_FUNCTION_ARGS) /* ** The GiST Consistent method for segments ** Should return false if for all data items x below entry, -** the predicate x op query == FALSE, where op is the oper +** the predicate x op query == false, where op is the oper ** corresponding to strategy in the pg_amop table. */ Datum @@ -413,9 +413,9 @@ gseg_same(PG_FUNCTION_ARGS) bool *result = (bool *) PG_GETARG_POINTER(2); if (DirectFunctionCall2(seg_same, PG_GETARG_DATUM(0), PG_GETARG_DATUM(1))) - *result = TRUE; + *result = true; else - *result = FALSE; + *result = false; #ifdef GIST_DEBUG fprintf(stderr, "same: %s\n", (*result ? "TRUE" : "FALSE")); @@ -465,7 +465,7 @@ gseg_leaf_consistent(Datum key, Datum query, StrategyNumber strategy) retval = DirectFunctionCall2(seg_contained, key, query); break; default: - retval = FALSE; + retval = false; } PG_RETURN_DATUM(retval); @@ -514,7 +514,7 @@ gseg_internal_consistent(Datum key, Datum query, StrategyNumber strategy) DatumGetBool(DirectFunctionCall2(seg_overlap, key, query)); break; default: - retval = FALSE; + retval = false; } PG_RETURN_BOOL(retval); diff --git a/doc/src/sgml/gin.sgml b/doc/src/sgml/gin.sgml index 7c2321ec3c..f5b5b9386c 100644 --- a/doc/src/sgml/gin.sgml +++ b/doc/src/sgml/gin.sgml @@ -223,9 +223,9 @@ <title>Extensibility</title> <para> <literal>pmatch</> is an output argument for use when partial match is supported. To use it, <function>extractQuery</> must allocate - an array of <literal>*nkeys</> booleans and store its address at - <literal>*pmatch</>. Each element of the array should be set to TRUE - if the corresponding key requires partial match, FALSE if not. + an array of <literal>*nkeys</> bools and store its address at + <literal>*pmatch</>. Each element of the array should be set to true + if the corresponding key requires partial match, false if not. If <literal>*pmatch</> is set to <symbol>NULL</symbol> then GIN assumes partial match is not required. The variable is initialized to <symbol>NULL</symbol> before call, so this argument can simply be ignored by operator classes that do @@ -267,7 +267,7 @@ <title>Extensibility</title> Datum queryKeys[], bool nullFlags[])</></term> <listitem> <para> - Returns TRUE if an indexed item satisfies the query operator with + Returns true if an indexed item satisfies the query operator with strategy number <literal>n</> (or might satisfy it, if the recheck indication is returned). This function does not have direct access to the indexed item's value, since <acronym>GIN</acronym> does not @@ -277,8 +277,8 @@ <title>Extensibility</title> <literal>nkeys</>, which is the same as the number of keys previously returned by <function>extractQuery</> for this <literal>query</> datum. Each element of the - <literal>check</> array is TRUE if the indexed item contains the - corresponding query key, i.e., if (check[i] == TRUE) the i-th key of the + <literal>check</> array is true if the indexed item contains the + corresponding query key, i.e., if (check[i] == true) the i-th key of the <function>extractQuery</> result array is present in the indexed item. The original <literal>query</> datum is passed in case the <function>consistent</> method needs to consult it, @@ -291,7 +291,7 @@ <title>Extensibility</title> <para> When <function>extractQuery</> returns a null key in <literal>queryKeys[]</>, the corresponding <literal>check[]</> element - is TRUE if the indexed item contains a null key; that is, the + is true if the indexed item contains a null key; that is, the semantics of <literal>check[]</> are like <literal>IS NOT DISTINCT FROM</>. The <function>consistent</> function can examine the corresponding <literal>nullFlags[]</> element if it needs to tell @@ -299,13 +299,13 @@ <title>Extensibility</title> </para> <para> - On success, <literal>*recheck</> should be set to TRUE if the heap - tuple needs to be rechecked against the query operator, or FALSE if - the index test is exact. That is, a FALSE return value guarantees - that the heap tuple does not match the query; a TRUE return value with - <literal>*recheck</> set to FALSE guarantees that the heap tuple does - match the query; and a TRUE return value with - <literal>*recheck</> set to TRUE means that the heap tuple might match + On success, <literal>*recheck</> should be set to true if the heap + tuple needs to be rechecked against the query operator, or false if + the index test is exact. That is, a false return value guarantees + that the heap tuple does not match the query; a true return value with + <literal>*recheck</> set to false guarantees that the heap tuple does + match the query; and a true return value with + <literal>*recheck</> set to true means that the heap tuple might match the query, so it needs to be fetched and rechecked by evaluating the query operator directly against the originally indexed item. </para> diff --git a/doc/src/sgml/indexam.sgml b/doc/src/sgml/indexam.sgml index ac512588e2..3e0f05d398 100644 --- a/doc/src/sgml/indexam.sgml +++ b/doc/src/sgml/indexam.sgml @@ -280,9 +280,9 @@ <title>Index Access Method Functions</title> <para> The function's Boolean result value is significant only when <literal>checkUnique</> is <literal>UNIQUE_CHECK_PARTIAL</>. - In this case a TRUE result means the new entry is known unique, whereas - FALSE means it might be non-unique (and a deferred uniqueness check must - be scheduled). For other cases a constant FALSE result is recommended. + In this case a true result means the new entry is known unique, whereas + false means it might be non-unique (and a deferred uniqueness check must + be scheduled). For other cases a constant false result is recommended. </para> <para> @@ -368,8 +368,8 @@ <title>Index Access Method Functions</title> linkend="indexes-index-only-scans"><firstterm>index-only scans</></link> on the given column, by returning the indexed column values for an index entry in the form of an <structname>IndexTuple</structname>. The attribute number - is 1-based, i.e. the first column's attno is 1. Returns TRUE if supported, - else FALSE. If the access method does not support index-only scans at all, + is 1-based, i.e. the first column's attno is 1. Returns true if supported, + else false. If the access method does not support index-only scans at all, the <structfield>amcanreturn</> field in its <structname>IndexAmRoutine</> struct can be set to NULL. </para> @@ -532,15 +532,15 @@ <title>Index Access Method Functions</title> ScanDirection direction); </programlisting> Fetch the next tuple in the given scan, moving in the given - direction (forward or backward in the index). Returns TRUE if a tuple was - obtained, FALSE if no matching tuples remain. In the TRUE case the tuple + direction (forward or backward in the index). Returns true if a tuple was + obtained, false if no matching tuples remain. In the true case the tuple TID is stored into the <literal>scan</> structure. Note that <quote>success</> means only that the index contains an entry that matches the scan keys, not that the tuple necessarily still exists in the heap or will pass the caller's snapshot test. On success, <function>amgettuple</> - must also set <literal>scan-&gt;xs_recheck</> to TRUE or FALSE. - FALSE means it is certain that the index entry matches the scan keys. - TRUE means this is not certain, and the conditions represented by the + must also set <literal>scan-&gt;xs_recheck</> to true or false. + False means it is certain that the index entry matches the scan keys. + true means this is not certain, and the conditions represented by the scan keys must be rechecked against the heap tuple after fetching it. This provision supports <quote>lossy</> index operators. Note that rechecking will extend only to the scan conditions; a partial @@ -550,7 +550,7 @@ <title>Index Access Method Functions</title> <para> If the index supports <link linkend="indexes-index-only-scans">index-only - scans</link> (i.e., <function>amcanreturn</function> returns TRUE for it), + scans</link> (i.e., <function>amcanreturn</function> returns true for it), then on success the AM must also check <literal>scan-&gt;xs_want_itup</>, and if that is true it must return the originally indexed data for the index entry. The data can be returned in the form of an @@ -1082,8 +1082,8 @@ <title>Index Uniqueness Checks</title> constraint is deferrable. <productname>PostgreSQL</productname> will use this mode to insert each row's index entry. The access method must allow duplicate entries into the index, and report any - potential duplicates by returning FALSE from <function>aminsert</>. - For each row for which FALSE is returned, a deferred recheck will + potential duplicates by returning false from <function>aminsert</>. + For each row for which false is returned, a deferred recheck will be scheduled. </para> diff --git a/doc/src/sgml/libpq.sgml b/doc/src/sgml/libpq.sgml index ad5e9b95b4..dad7f53f52 100644 --- a/doc/src/sgml/libpq.sgml +++ b/doc/src/sgml/libpq.sgml @@ -6965,12 +6965,12 @@ <title>Event Example</title> break; } - /* unknown event ID, just return TRUE. */ + /* unknown event ID, just return true. */ default: break; } - return TRUE; /* event processing succeeded */ + return true; /* event processing succeeded */ } ]]> </programlisting> diff --git a/doc/src/sgml/spgist.sgml b/doc/src/sgml/spgist.sgml index cd4a8d07c4..2842a3c5d9 100644 --- a/doc/src/sgml/spgist.sgml +++ b/doc/src/sgml/spgist.sgml @@ -794,7 +794,7 @@ <title>SP-GiST Limits</title> trees, in which each level of the tree includes a prefix that is short enough to fit on a page, and the final leaf level includes a suffix also short enough to fit on a page. The operator class should set - <structfield>longValuesOK</> to TRUE only if it is prepared to arrange for + <structfield>longValuesOK</> to true only if it is prepared to arrange for this to happen. Otherwise, the <acronym>SP-GiST</acronym> core will reject any request to index a value that is too large to fit on an index page. diff --git a/doc/src/sgml/sslinfo.sgml b/doc/src/sgml/sslinfo.sgml index 7bda33efa3..ac7bf63a97 100644 --- a/doc/src/sgml/sslinfo.sgml +++ b/doc/src/sgml/sslinfo.sgml @@ -32,7 +32,7 @@ <title>Functions Provided</title> </term> <listitem> <para> - Returns TRUE if current connection to server uses SSL, and FALSE + Returns true if current connection to server uses SSL, and false otherwise. </para> </listitem> @@ -77,8 +77,8 @@ <title>Functions Provided</title> </term> <listitem> <para> - Returns TRUE if current client has presented a valid SSL client - certificate to the server, and FALSE otherwise. (The server + Returns true if current client has presented a valid SSL client + certificate to the server, and false otherwise. (The server might or might not be configured to require a client certificate.) </para> </listitem> diff --git a/src/backend/access/gin/ginbtree.c b/src/backend/access/gin/ginbtree.c index b02cb8ae58..1b920facc2 100644 --- a/src/backend/access/gin/ginbtree.c +++ b/src/backend/access/gin/ginbtree.c @@ -41,7 +41,7 @@ ginTraverseLock(Buffer buffer, bool searchMode) page = BufferGetPage(buffer); if (GinPageIsLeaf(page)) { - if (searchMode == FALSE) + if (searchMode == false) { /* we should relock our page */ LockBuffer(buffer, GIN_UNLOCK); @@ -107,7 +107,7 @@ ginFindLeafPage(GinBtree btree, bool searchMode, Snapshot snapshot) * ok, page is correctly locked, we should check to move right .., * root never has a right link, so small optimization */ - while (btree->fullScan == FALSE && stack->blkno != btree->rootBlkno && + while (btree->fullScan == false && stack->blkno != btree->rootBlkno && btree->isMoveRight(btree, page)) { BlockNumber rightlink = GinPageGetOpaque(page)->rightlink; diff --git a/src/backend/access/gin/ginbulk.c b/src/backend/access/gin/ginbulk.c index 4ff149e59a..d5b9e78133 100644 --- a/src/backend/access/gin/ginbulk.c +++ b/src/backend/access/gin/ginbulk.c @@ -52,7 +52,7 @@ ginCombineData(RBNode *existing, const RBNode *newdata, void *arg) } /* If item pointers are not ordered, they will need to be sorted later */ - if (eo->shouldSort == FALSE) + if (eo->shouldSort == false) { int res; @@ -60,7 +60,7 @@ ginCombineData(RBNode *existing, const RBNode *newdata, void *arg) Assert(res != 0); if (res > 0) - eo->shouldSort = TRUE; + eo->shouldSort = true; } eo->list[eo->count] = en->list[0]; @@ -175,7 +175,7 @@ ginInsertBAEntry(BuildAccumulator *accum, ea->key = getDatumCopy(accum, attnum, key); ea->maxcount = DEF_NPTR; ea->count = 1; - ea->shouldSort = FALSE; + ea->shouldSort = false; ea->list = (ItemPointerData *) palloc(sizeof(ItemPointerData) * DEF_NPTR); ea->list[0] = *heapptr; diff --git a/src/backend/access/gin/gindatapage.c b/src/backend/access/gin/gindatapage.c index 2e5ea47976..9c6cba4825 100644 --- a/src/backend/access/gin/gindatapage.c +++ b/src/backend/access/gin/gindatapage.c @@ -235,9 +235,9 @@ dataIsMoveRight(GinBtree btree, Page page) ItemPointer iptr = GinDataPageGetRightBound(page); if (GinPageRightMost(page)) - return FALSE; + return false; - return (ginCompareItemPointers(&btree->itemptr, iptr) > 0) ? TRUE : FALSE; + return (ginCompareItemPointers(&btree->itemptr, iptr) > 0) ? true : false; } /* @@ -1875,9 +1875,9 @@ ginPrepareDataScan(GinBtree btree, Relation index, BlockNumber rootBlkno) btree->fillRoot = ginDataFillRoot; btree->prepareDownlink = dataPrepareDownlink; - btree->isData = TRUE; - btree->fullScan = FALSE; - btree->isBuild = FALSE; + btree->isData = true; + btree->fullScan = false; + btree->isBuild = false; } /* @@ -1919,9 +1919,9 @@ ginScanBeginPostingTree(GinBtree btree, Relation index, BlockNumber rootBlkno, ginPrepareDataScan(btree, index, rootBlkno); - btree->fullScan = TRUE; + btree->fullScan = true; - stack = ginFindLeafPage(btree, TRUE, snapshot); + stack = ginFindLeafPage(btree, true, snapshot); return stack; } diff --git a/src/backend/access/gin/ginentrypage.c b/src/backend/access/gin/ginentrypage.c index d5cc70258a..bf7b05107b 100644 --- a/src/backend/access/gin/ginentrypage.c +++ b/src/backend/access/gin/ginentrypage.c @@ -30,7 +30,7 @@ static void entrySplitPage(GinBtree btree, Buffer origbuf, * Form a tuple for entry tree. * * If the tuple would be too big to be stored, function throws a suitable - * error if errorTooBig is TRUE, or returns NULL if errorTooBig is FALSE. + * error if errorTooBig is true, or returns NULL if errorTooBig is false. * * See src/backend/access/gin/README for a description of the index tuple * format that is being built here. We build on the assumption that we @@ -249,7 +249,7 @@ entryIsMoveRight(GinBtree btree, Page page) GinNullCategory category; if (GinPageRightMost(page)) - return FALSE; + return false; itup = getRightMostTuple(page); attnum = gintuple_get_attrnum(btree->ginstate, itup); @@ -258,9 +258,9 @@ entryIsMoveRight(GinBtree btree, Page page) if (ginCompareAttEntries(btree->ginstate, btree->entryAttnum, btree->entryKey, btree->entryCategory, attnum, key, category) > 0) - return TRUE; + return true; - return FALSE; + return false; } /* @@ -356,7 +356,7 @@ entryLocateLeafEntry(GinBtree btree, GinBtreeStack *stack) if (btree->fullScan) { stack->off = FirstOffsetNumber; - return TRUE; + return true; } low = FirstOffsetNumber; @@ -762,9 +762,9 @@ ginPrepareEntryScan(GinBtree btree, OffsetNumber attnum, btree->fillRoot = ginEntryFillRoot; btree->prepareDownlink = entryPrepareDownlink; - btree->isData = FALSE; - btree->fullScan = FALSE; - btree->isBuild = FALSE; + btree->isData = false; + btree->fullScan = false; + btree->isBuild = false; btree->entryAttnum = attnum; btree->entryKey = key; diff --git a/src/backend/access/gin/ginget.c b/src/backend/access/gin/ginget.c index 56a5bf47b8..2729297643 100644 --- a/src/backend/access/gin/ginget.c +++ b/src/backend/access/gin/ginget.c @@ -311,7 +311,7 @@ startScanEntry(GinState *ginstate, GinScanEntry entry, Snapshot snapshot) entry->nlist = 0; entry->matchBitmap = NULL; entry->matchResult = NULL; - entry->reduceResult = FALSE; + entry->reduceResult = false; entry->predictNumberResult = 0; /* @@ -324,9 +324,9 @@ startScanEntry(GinState *ginstate, GinScanEntry entry, Snapshot snapshot) stackEntry = ginFindLeafPage(&btreeEntry, true, snapshot); page = BufferGetPage(stackEntry->buffer); /* ginFindLeafPage() will have already checked snapshot age. */ - needUnlock = TRUE; + needUnlock = true; - entry->isFinished = TRUE; + entry->isFinished = true; if (entry->isPartialMatch || entry->queryCategory == GIN_CAT_EMPTY_QUERY) @@ -363,7 +363,7 @@ startScanEntry(GinState *ginstate, GinScanEntry entry, Snapshot snapshot) if (entry->matchBitmap && !tbm_is_empty(entry->matchBitmap)) { entry->matchIterator = tbm_begin_iterate(entry->matchBitmap); - entry->isFinished = FALSE; + entry->isFinished = false; } } else if (btreeEntry.findItem(&btreeEntry, stackEntry)) @@ -385,7 +385,7 @@ startScanEntry(GinState *ginstate, GinScanEntry entry, Snapshot snapshot) * root of posting tree. */ LockBuffer(stackEntry->buffer, GIN_UNLOCK); - needUnlock = FALSE; + needUnlock = false; stack = ginScanBeginPostingTree(&entry->btree, ginstate->index, rootPostingTree, snapshot); @@ -410,7 +410,7 @@ startScanEntry(GinState *ginstate, GinScanEntry entry, Snapshot snapshot) LockBuffer(entry->buffer, GIN_UNLOCK); freeGinBtreeStack(stack); - entry->isFinished = FALSE; + entry->isFinished = false; } else if (GinGetNPosting(itup) > 0) { @@ -418,7 +418,7 @@ startScanEntry(GinState *ginstate, GinScanEntry entry, Snapshot snapshot) &entry->nlist); entry->predictNumberResult = entry->nlist; - entry->isFinished = FALSE; + entry->isFinished = false; } } @@ -565,7 +565,7 @@ startScan(IndexScanDesc scan) for (i = 0; i < so->totalentries; i++) { so->entries[i]->predictNumberResult /= so->totalentries; - so->entries[i]->reduceResult = TRUE; + so->entries[i]->reduceResult = true; } } } @@ -666,7 +666,7 @@ entryLoadMoreItems(GinState *ginstate, GinScanEntry entry, { UnlockReleaseBuffer(entry->buffer); entry->buffer = InvalidBuffer; - entry->isFinished = TRUE; + entry->isFinished = true; return; } @@ -728,7 +728,7 @@ entryLoadMoreItems(GinState *ginstate, GinScanEntry entry, /* * Sets entry->curItem to next heap item pointer > advancePast, for one entry - * of one scan key, or sets entry->isFinished to TRUE if there are no more. + * of one scan key, or sets entry->isFinished to true if there are no more. * * Item pointers are returned in ascending order. * @@ -775,7 +775,7 @@ entryGetItem(GinState *ginstate, GinScanEntry entry, ItemPointerSetInvalid(&entry->curItem); tbm_end_iterate(entry->matchIterator); entry->matchIterator = NULL; - entry->isFinished = TRUE; + entry->isFinished = true; break; } @@ -835,7 +835,7 @@ entryGetItem(GinState *ginstate, GinScanEntry entry, entry->matchResult->offsets[entry->offset]); entry->offset++; gotitem = true; - } while (!gotitem || (entry->reduceResult == TRUE && dropItem(entry))); + } while (!gotitem || (entry->reduceResult == true && dropItem(entry))); } else if (!BufferIsValid(entry->buffer)) { @@ -848,7 +848,7 @@ entryGetItem(GinState *ginstate, GinScanEntry entry, if (entry->offset >= entry->nlist) { ItemPointerSetInvalid(&entry->curItem); - entry->isFinished = TRUE; + entry->isFinished = true; break; } @@ -876,7 +876,7 @@ entryGetItem(GinState *ginstate, GinScanEntry entry, entry->curItem = entry->list[entry->offset++]; } while (ginCompareItemPointers(&entry->curItem, &advancePast) <= 0 || - (entry->reduceResult == TRUE && dropItem(entry))); + (entry->reduceResult == true && dropItem(entry))); } } @@ -891,7 +891,7 @@ entryGetItem(GinState *ginstate, GinScanEntry entry, * iff recheck is needed for this item pointer (including the case where the * item pointer is a lossy page pointer). * - * If all entry streams are exhausted, sets key->isFinished to TRUE. + * If all entry streams are exhausted, sets key->isFinished to true. * * Item pointers must be returned in ascending order. * @@ -963,7 +963,7 @@ keyGetItem(GinState *ginstate, MemoryContext tempCtx, GinScanKey key, if (allFinished) { /* all entries are finished */ - key->isFinished = TRUE; + key->isFinished = true; return; } @@ -1051,7 +1051,7 @@ keyGetItem(GinState *ginstate, MemoryContext tempCtx, GinScanKey key, * them. We could pass them as MAYBE as well, but if we're using the * "shim" implementation of a tri-state consistent function (see * ginlogic.c), it's better to pass as few MAYBEs as possible. So pass - * them as TRUE. + * them as true. * * Note that only lossy-page entries pointing to the current item's page * should trigger this processing; we might have future lossy pages in the @@ -1064,7 +1064,7 @@ keyGetItem(GinState *ginstate, MemoryContext tempCtx, GinScanKey key, for (i = 0; i < key->nentries; i++) { entry = key->scanEntry[i]; - if (entry->isFinished == FALSE && + if (entry->isFinished == false && ginCompareItemPointers(&entry->curItem, &curPageLossy) == 0) { if (i < key->nuserentries) @@ -1314,7 +1314,7 @@ scanGetItem(IndexScanDesc scan, ItemPointerData advancePast, } } - return TRUE; + return true; } @@ -1508,7 +1508,7 @@ collectMatchesForHeapRow(IndexScanDesc scan, pendingPosition *pos) memset(key->entryRes, GIN_FALSE, key->nentries); } - memset(pos->hasMatchKey, FALSE, so->nkeys); + memset(pos->hasMatchKey, false, so->nkeys); /* * Outer loop iterates over multiple pending-list pages when a single heap diff --git a/src/backend/access/gin/gininsert.c b/src/backend/access/gin/gininsert.c index 5378011f50..8acc2b25b2 100644 --- a/src/backend/access/gin/gininsert.c +++ b/src/backend/access/gin/gininsert.c @@ -185,7 +185,7 @@ ginEntryInsert(GinState *ginstate, IndexTuple itup; Page page; - insertdata.isDelete = FALSE; + insertdata.isDelete = false; /* During index build, count the to-be-inserted entry */ if (buildStats) @@ -221,7 +221,7 @@ ginEntryInsert(GinState *ginstate, itup = addItemPointersToLeafTuple(ginstate, itup, items, nitem, buildStats); - insertdata.isDelete = TRUE; + insertdata.isDelete = true; } else { diff --git a/src/backend/access/gin/ginvacuum.c b/src/backend/access/gin/ginvacuum.c index 31425e9963..a20a99c814 100644 --- a/src/backend/access/gin/ginvacuum.c +++ b/src/backend/access/gin/ginvacuum.c @@ -235,7 +235,7 @@ ginScanToDelete(GinVacuumState *gvs, BlockNumber blkno, bool isRoot, DataPageDeleteStack *me; Buffer buffer; Page page; - bool meDelete = FALSE; + bool meDelete = false; bool isempty; if (isRoot) @@ -274,7 +274,7 @@ ginScanToDelete(GinVacuumState *gvs, BlockNumber blkno, bool isRoot, { PostingItem *pitem = GinDataPageGetPostingItem(page, i); - if (ginScanToDelete(gvs, PostingItemGetBlockNumber(pitem), FALSE, me, i)) + if (ginScanToDelete(gvs, PostingItemGetBlockNumber(pitem), false, me, i)) i--; } } @@ -291,7 +291,7 @@ ginScanToDelete(GinVacuumState *gvs, BlockNumber blkno, bool isRoot, { Assert(!isRoot); ginDeletePage(gvs, blkno, me->leftBlkno, me->parent->blkno, myoff, me->parent->isRoot); - meDelete = TRUE; + meDelete = true; } } @@ -319,7 +319,7 @@ ginVacuumPostingTreeLeaves(GinVacuumState *gvs, BlockNumber blkno, bool isRoot) { Buffer buffer; Page page; - bool hasVoidPage = FALSE; + bool hasVoidPage = false; MemoryContext oldCxt; buffer = ReadBufferExtended(gvs->index, MAIN_FORKNUM, blkno, @@ -339,7 +339,7 @@ ginVacuumPostingTreeLeaves(GinVacuumState *gvs, BlockNumber blkno, bool isRoot) /* if root is a leaf page, we don't desire further processing */ if (GinDataLeafPageIsEmpty(page)) - hasVoidPage = TRUE; + hasVoidPage = true; UnlockReleaseBuffer(buffer); @@ -348,8 +348,8 @@ ginVacuumPostingTreeLeaves(GinVacuumState *gvs, BlockNumber blkno, bool isRoot) else { OffsetNumber i; - bool hasEmptyChild = FALSE; - bool hasNonEmptyChild = FALSE; + bool hasEmptyChild = false; + bool hasNonEmptyChild = false; OffsetNumber maxoff = GinPageGetOpaque(page)->maxoff; BlockNumber *children = palloc(sizeof(BlockNumber) * (maxoff + 1)); @@ -369,10 +369,10 @@ ginVacuumPostingTreeLeaves(GinVacuumState *gvs, BlockNumber blkno, bool isRoot) for (i = FirstOffsetNumber; i <= maxoff; i++) { - if (ginVacuumPostingTreeLeaves(gvs, children[i], FALSE)) - hasEmptyChild = TRUE; + if (ginVacuumPostingTreeLeaves(gvs, children[i], false)) + hasEmptyChild = true; else - hasNonEmptyChild = TRUE; + hasNonEmptyChild = true; } pfree(children); @@ -380,12 +380,12 @@ ginVacuumPostingTreeLeaves(GinVacuumState *gvs, BlockNumber blkno, bool isRoot) vacuum_delay_point(); /* - * All subtree is empty - just return TRUE to indicate that parent + * All subtree is empty - just return true to indicate that parent * must do a cleanup. Unless we are ROOT an there is way to go upper. */ if (hasEmptyChild && !hasNonEmptyChild && !isRoot) - return TRUE; + return true; if (hasEmptyChild) { @@ -399,9 +399,9 @@ ginVacuumPostingTreeLeaves(GinVacuumState *gvs, BlockNumber blkno, bool isRoot) memset(&root, 0, sizeof(DataPageDeleteStack)); root.leftBlkno = InvalidBlockNumber; - root.isRoot = TRUE; + root.isRoot = true; - ginScanToDelete(gvs, blkno, TRUE, &root, InvalidOffsetNumber); + ginScanToDelete(gvs, blkno, true, &root, InvalidOffsetNumber); ptr = root.child; @@ -416,14 +416,14 @@ ginVacuumPostingTreeLeaves(GinVacuumState *gvs, BlockNumber blkno, bool isRoot) } /* Here we have deleted all empty subtrees */ - return FALSE; + return false; } } static void ginVacuumPostingTree(GinVacuumState *gvs, BlockNumber rootBlkno) { - ginVacuumPostingTreeLeaves(gvs, rootBlkno, TRUE); + ginVacuumPostingTreeLeaves(gvs, rootBlkno, true); } /* diff --git a/src/backend/access/gist/gist.c b/src/backend/access/gist/gist.c index 565525bbdf..121dc016da 100644 --- a/src/backend/access/gist/gist.c +++ b/src/backend/access/gist/gist.c @@ -1364,8 +1364,8 @@ gistSplit(Relation r, IndexTupleSize(itup[0]), GiSTPageSize, RelationGetRelationName(r)))); - memset(v.spl_lisnull, TRUE, sizeof(bool) * giststate->tupdesc->natts); - memset(v.spl_risnull, TRUE, sizeof(bool) * giststate->tupdesc->natts); + memset(v.spl_lisnull, true, sizeof(bool) * giststate->tupdesc->natts); + memset(v.spl_risnull, true, sizeof(bool) * giststate->tupdesc->natts); gistSplitByKey(r, page, itup, len, giststate, &v, 0); /* form left and right vector */ diff --git a/src/backend/access/gist/gistget.c b/src/backend/access/gist/gistget.c index 760ea0c997..bb1dd9e9cc 100644 --- a/src/backend/access/gist/gistget.c +++ b/src/backend/access/gist/gistget.c @@ -197,7 +197,7 @@ gistindex_keytest(IndexScanDesc scan, gistdentryinit(giststate, key->sk_attno - 1, &de, datum, r, page, offset, - FALSE, isNull); + false, isNull); /* * Call the Consistent function to evaluate the test. The @@ -258,7 +258,7 @@ gistindex_keytest(IndexScanDesc scan, gistdentryinit(giststate, key->sk_attno - 1, &de, datum, r, page, offset, - FALSE, isNull); + false, isNull); /* * Call the Distance function to evaluate the distance. The diff --git a/src/backend/access/gist/gistproc.c b/src/backend/access/gist/gistproc.c index 08990f5a1b..b864053ee3 100644 --- a/src/backend/access/gist/gistproc.c +++ b/src/backend/access/gist/gistproc.c @@ -105,7 +105,7 @@ box_penalty(const BOX *original, const BOX *new) * The GiST Consistent method for boxes * * Should return false if for all data items x below entry, - * the predicate x op query must be FALSE, where op is the oper + * the predicate x op query must be false, where op is the oper * corresponding to strategy in the pg_amop table. */ Datum @@ -122,7 +122,7 @@ gist_box_consistent(PG_FUNCTION_ARGS) *recheck = false; if (DatumGetBoxP(entry->key) == NULL || query == NULL) - PG_RETURN_BOOL(FALSE); + PG_RETURN_BOOL(false); /* * if entry is not leaf, use rtree_internal_consistent, else use @@ -1084,7 +1084,7 @@ gist_poly_compress(PG_FUNCTION_ARGS) retval = (GISTENTRY *) palloc(sizeof(GISTENTRY)); gistentryinit(*retval, PointerGetDatum(r), entry->rel, entry->page, - entry->offset, FALSE); + entry->offset, false); } else retval = entry; @@ -1109,7 +1109,7 @@ gist_poly_consistent(PG_FUNCTION_ARGS) *recheck = true; if (DatumGetBoxP(entry->key) == NULL || query == NULL) - PG_RETURN_BOOL(FALSE); + PG_RETURN_BOOL(false); /* * Since the operators require recheck anyway, we can just use @@ -1152,7 +1152,7 @@ gist_circle_compress(PG_FUNCTION_ARGS) retval = (GISTENTRY *) palloc(sizeof(GISTENTRY)); gistentryinit(*retval, PointerGetDatum(r), entry->rel, entry->page, - entry->offset, FALSE); + entry->offset, false); } else retval = entry; @@ -1178,7 +1178,7 @@ gist_circle_consistent(PG_FUNCTION_ARGS) *recheck = true; if (DatumGetBoxP(entry->key) == NULL || query == NULL) - PG_RETURN_BOOL(FALSE); + PG_RETURN_BOOL(false); /* * Since the operators require recheck anyway, we can just use @@ -1214,7 +1214,7 @@ gist_point_compress(PG_FUNCTION_ARGS) box->high = box->low = *point; gistentryinit(*retval, BoxPGetDatum(box), - entry->rel, entry->page, entry->offset, FALSE); + entry->rel, entry->page, entry->offset, false); PG_RETURN_POINTER(retval); } @@ -1243,7 +1243,7 @@ gist_point_fetch(PG_FUNCTION_ARGS) r->y = in->high.y; gistentryinit(*retval, PointerGetDatum(r), entry->rel, entry->page, - entry->offset, FALSE); + entry->offset, false); PG_RETURN_POINTER(retval); } diff --git a/src/backend/access/gist/gistsplit.c b/src/backend/access/gist/gistsplit.c index 617f42c317..9efb16dd24 100644 --- a/src/backend/access/gist/gistsplit.c +++ b/src/backend/access/gist/gistsplit.c @@ -125,7 +125,7 @@ findDontCares(Relation r, GISTSTATE *giststate, GISTENTRY *valvec, * check for nulls */ gistentryinit(entry, spl->splitVector.spl_rdatum, r, NULL, - (OffsetNumber) 0, FALSE); + (OffsetNumber) 0, false); for (i = 0; i < spl->splitVector.spl_nleft; i++) { int j = spl->splitVector.spl_left[i]; @@ -141,7 +141,7 @@ findDontCares(Relation r, GISTSTATE *giststate, GISTENTRY *valvec, /* And conversely for the right-side tuples */ gistentryinit(entry, spl->splitVector.spl_ldatum, r, NULL, - (OffsetNumber) 0, FALSE); + (OffsetNumber) 0, false); for (i = 0; i < spl->splitVector.spl_nright; i++) { int j = spl->splitVector.spl_right[i]; @@ -177,7 +177,7 @@ removeDontCares(OffsetNumber *a, int *len, const bool *dontcare) { OffsetNumber ai = a[i]; - if (dontcare[ai] == FALSE) + if (dontcare[ai] == false) { /* re-emit item into a[] */ *curwpos = ai; @@ -213,10 +213,10 @@ placeOne(Relation r, GISTSTATE *giststate, GistSplitVector *v, rpenalty; GISTENTRY entry; - gistentryinit(entry, v->spl_lattr[attno], r, NULL, 0, FALSE); + gistentryinit(entry, v->spl_lattr[attno], r, NULL, 0, false); lpenalty = gistpenalty(giststate, attno, &entry, v->spl_lisnull[attno], identry + attno, isnull[attno]); - gistentryinit(entry, v->spl_rattr[attno], r, NULL, 0, FALSE); + gistentryinit(entry, v->spl_rattr[attno], r, NULL, 0, false); rpenalty = gistpenalty(giststate, attno, &entry, v->spl_risnull[attno], identry + attno, isnull[attno]); @@ -265,10 +265,10 @@ supportSecondarySplit(Relation r, GISTSTATE *giststate, int attno, entrySL, entrySR; - gistentryinit(entryL, oldL, r, NULL, 0, FALSE); - gistentryinit(entryR, oldR, r, NULL, 0, FALSE); - gistentryinit(entrySL, sv->spl_ldatum, r, NULL, 0, FALSE); - gistentryinit(entrySR, sv->spl_rdatum, r, NULL, 0, FALSE); + gistentryinit(entryL, oldL, r, NULL, 0, false); + gistentryinit(entryR, oldR, r, NULL, 0, false); + gistentryinit(entrySL, sv->spl_ldatum, r, NULL, 0, false); + gistentryinit(entrySR, sv->spl_rdatum, r, NULL, 0, false); if (sv->spl_ldatum_exists && sv->spl_rdatum_exists) { @@ -320,8 +320,8 @@ supportSecondarySplit(Relation r, GISTSTATE *giststate, int attno, SWAPVAR(sv->spl_left, sv->spl_right, off); SWAPVAR(sv->spl_nleft, sv->spl_nright, noff); SWAPVAR(sv->spl_ldatum, sv->spl_rdatum, datum); - gistentryinit(entrySL, sv->spl_ldatum, r, NULL, 0, FALSE); - gistentryinit(entrySR, sv->spl_rdatum, r, NULL, 0, FALSE); + gistentryinit(entrySL, sv->spl_ldatum, r, NULL, 0, false); + gistentryinit(entrySR, sv->spl_rdatum, r, NULL, 0, false); } if (sv->spl_ldatum_exists) @@ -396,20 +396,20 @@ genericPickSplit(GISTSTATE *giststate, GistEntryVector *entryvec, GIST_SPLITVEC * Calls user picksplit method for attno column to split tuples into * two vectors. * - * Returns FALSE if split is complete (there are no more index columns, or + * Returns false if split is complete (there are no more index columns, or * there is no need to consider them because split is optimal already). * - * Returns TRUE and v->spl_dontcare = NULL if the picksplit result is + * Returns true and v->spl_dontcare = NULL if the picksplit result is * degenerate (all tuples seem to be don't-cares), so we should just * disregard this column and split on the next column(s) instead. * - * Returns TRUE and v->spl_dontcare != NULL if there are don't-care tuples + * Returns true and v->spl_dontcare != NULL if there are don't-care tuples * that could be relocated based on the next column(s). The don't-care * tuples have been removed from the split and must be reinserted by caller. * There is at least one non-don't-care tuple on each side of the split, * and union keys for all columns are updated to include just those tuples. * - * A TRUE result implies there is at least one more index column. + * A true result implies there is at least one more index column. */ static bool gistUserPicksplit(Relation r, GistEntryVector *entryvec, int attno, GistSplitVector *v, @@ -610,7 +610,7 @@ gistSplitHalf(GIST_SPLITVEC *v, int len) * attno: column we are working on (zero-based index) * * Outside caller must initialize v->spl_lisnull and v->spl_risnull arrays - * to all-TRUE. On return, spl_left/spl_nleft contain indexes of tuples + * to all-true. On return, spl_left/spl_nleft contain indexes of tuples * to go left, spl_right/spl_nright contain indexes of tuples to go right, * spl_lattr/spl_lisnull contain left-side union key values, and * spl_rattr/spl_risnull contain right-side union key values. Other fields @@ -643,7 +643,7 @@ gistSplitByKey(Relation r, Page page, IndexTuple *itup, int len, &IsNull); gistdentryinit(giststate, attno, &(entryvec->vector[i]), datum, r, page, i, - FALSE, IsNull); + false, IsNull); if (IsNull) offNullTuples[nOffNullTuples++] = i; } @@ -655,7 +655,7 @@ gistSplitByKey(Relation r, Page page, IndexTuple *itup, int len, * our attention to the next column. If there's no next column, just * split page in half. */ - v->spl_risnull[attno] = v->spl_lisnull[attno] = TRUE; + v->spl_risnull[attno] = v->spl_lisnull[attno] = true; if (attno + 1 < giststate->tupdesc->natts) gistSplitByKey(r, page, itup, len, giststate, v, attno + 1); @@ -672,7 +672,7 @@ gistSplitByKey(Relation r, Page page, IndexTuple *itup, int len, */ v->splitVector.spl_right = offNullTuples; v->splitVector.spl_nright = nOffNullTuples; - v->spl_risnull[attno] = TRUE; + v->spl_risnull[attno] = true; v->splitVector.spl_left = (OffsetNumber *) palloc(len * sizeof(OffsetNumber)); v->splitVector.spl_nleft = 0; diff --git a/src/backend/access/gist/gistutil.c b/src/backend/access/gist/gistutil.c index b6ccc1a66a..c7e9b2b1b6 100644 --- a/src/backend/access/gist/gistutil.c +++ b/src/backend/access/gist/gistutil.c @@ -179,7 +179,7 @@ gistMakeUnionItVec(GISTSTATE *giststate, IndexTuple *itvec, int len, evec->vector + evec->n, datum, NULL, NULL, (OffsetNumber) 0, - FALSE, IsNull); + false, IsNull); evec->n++; } @@ -187,7 +187,7 @@ gistMakeUnionItVec(GISTSTATE *giststate, IndexTuple *itvec, int len, if (evec->n == 0) { attr[i] = (Datum) 0; - isnull[i] = TRUE; + isnull[i] = true; } else { @@ -204,7 +204,7 @@ gistMakeUnionItVec(GISTSTATE *giststate, IndexTuple *itvec, int len, PointerGetDatum(evec), PointerGetDatum(&attrsize)); - isnull[i] = FALSE; + isnull[i] = false; } } } @@ -246,17 +246,17 @@ gistMakeUnionKey(GISTSTATE *giststate, int attno, if (isnull1 && isnull2) { - *dstisnull = TRUE; + *dstisnull = true; *dst = (Datum) 0; } else { - if (isnull1 == FALSE && isnull2 == FALSE) + if (isnull1 == false && isnull2 == false) { evec->vector[0] = *entry1; evec->vector[1] = *entry2; } - else if (isnull1 == FALSE) + else if (isnull1 == false) { evec->vector[0] = *entry1; evec->vector[1] = *entry1; @@ -267,7 +267,7 @@ gistMakeUnionKey(GISTSTATE *giststate, int attno, evec->vector[1] = *entry2; } - *dstisnull = FALSE; + *dstisnull = false; *dst = FunctionCall2Coll(&giststate->unionFn[attno], giststate->supportCollation[attno], PointerGetDatum(evec), @@ -303,7 +303,7 @@ gistDeCompressAtt(GISTSTATE *giststate, Relation r, IndexTuple tuple, Page p, datum = index_getattr(tuple, i + 1, giststate->tupdesc, &isnull[i]); gistdentryinit(giststate, i, &attdata[i], datum, r, p, o, - FALSE, isnull[i]); + false, isnull[i]); } } @@ -313,7 +313,7 @@ gistDeCompressAtt(GISTSTATE *giststate, Relation r, IndexTuple tuple, Page p, IndexTuple gistgetadjusted(Relation r, IndexTuple oldtup, IndexTuple addtup, GISTSTATE *giststate) { - bool neednew = FALSE; + bool neednew = false; GISTENTRY oldentries[INDEX_MAX_KEYS], addentries[INDEX_MAX_KEYS]; bool oldisnull[INDEX_MAX_KEYS], @@ -451,7 +451,7 @@ gistchoose(Relation r, Page p, IndexTuple it, /* it has compressed entry */ /* Compute penalty for this column. */ datum = index_getattr(itup, j + 1, giststate->tupdesc, &IsNull); gistdentryinit(giststate, j, &entry, datum, r, p, i, - FALSE, IsNull); + false, IsNull); usize = gistpenalty(giststate, j, &entry, IsNull, &identry[j], isnull[j]); if (usize > 0) @@ -671,8 +671,8 @@ gistpenalty(GISTSTATE *giststate, int attno, { float penalty = 0.0; - if (giststate->penaltyFn[attno].fn_strict == FALSE || - (isNullOrig == FALSE && isNullAdd == FALSE)) + if (giststate->penaltyFn[attno].fn_strict == false || + (isNullOrig == false && isNullAdd == false)) { FunctionCall3Coll(&giststate->penaltyFn[attno], giststate->supportCollation[attno], diff --git a/src/backend/commands/tablecmds.c b/src/backend/commands/tablecmds.c index 513a9ec485..06ae69a003 100644 --- a/src/backend/commands/tablecmds.c +++ b/src/backend/commands/tablecmds.c @@ -2254,7 +2254,7 @@ MergeAttributes(List *schema, List *supers, char relpersistence, * * constraints is a list of CookedConstraint structs for previous constraints. * - * Returns TRUE if merged (constraint is a duplicate), or FALSE if it's + * Returns true if merged (constraint is a duplicate), or false if it's * got a so-far-unique name, or throws error if conflict. */ static bool @@ -5701,7 +5701,7 @@ ATExecDropNotNull(Relation rel, const char *colName, LOCKMODE lockmode) */ if (((Form_pg_attribute) GETSTRUCT(tuple))->attnotnull) { - ((Form_pg_attribute) GETSTRUCT(tuple))->attnotnull = FALSE; + ((Form_pg_attribute) GETSTRUCT(tuple))->attnotnull = false; CatalogTupleUpdate(attr_rel, &tuple->t_self, tuple); @@ -5782,7 +5782,7 @@ ATExecSetNotNull(AlteredTableInfo *tab, Relation rel, */ if (!((Form_pg_attribute) GETSTRUCT(tuple))->attnotnull) { - ((Form_pg_attribute) GETSTRUCT(tuple))->attnotnull = TRUE; + ((Form_pg_attribute) GETSTRUCT(tuple))->attnotnull = true; CatalogTupleUpdate(attr_rel, &tuple->t_self, tuple); @@ -8202,16 +8202,16 @@ validateForeignKeyConstraint(char *conname, trig.tgoid = InvalidOid; trig.tgname = conname; trig.tgenabled = TRIGGER_FIRES_ON_ORIGIN; - trig.tgisinternal = TRUE; + trig.tgisinternal = true; trig.tgconstrrelid = RelationGetRelid(pkrel); trig.tgconstrindid = pkindOid; trig.tgconstraint = constraintOid; - trig.tgdeferrable = FALSE; - trig.tginitdeferred = FALSE; + trig.tgdeferrable = false; + trig.tginitdeferred = false; /* we needn't fill in remaining fields */ /* - * See if we can do it with a single LEFT JOIN query. A FALSE result + * See if we can do it with a single LEFT JOIN query. A false result * indicates we must proceed with the fire-the-trigger method. */ if (RI_Initial_Check(&trig, rel, pkrel)) diff --git a/src/backend/executor/nodeAgg.c b/src/backend/executor/nodeAgg.c index 6a26773a49..7e21b93503 100644 --- a/src/backend/executor/nodeAgg.c +++ b/src/backend/executor/nodeAgg.c @@ -2597,7 +2597,7 @@ agg_retrieve_hash_table(AggState *aggstate) else { /* No more hashtables, so done */ - aggstate->agg_done = TRUE; + aggstate->agg_done = true; return NULL; } } diff --git a/src/backend/executor/nodeAppend.c b/src/backend/executor/nodeAppend.c index bed9bb8713..1d2fb35d55 100644 --- a/src/backend/executor/nodeAppend.c +++ b/src/backend/executor/nodeAppend.c @@ -88,10 +88,10 @@ exec_append_initialize_next(AppendState *appendstate) /* * if scanning in reverse, we start at the last scan in the list and * then proceed back to the first.. in any case we inform ExecAppend - * that we are at the end of the line by returning FALSE + * that we are at the end of the line by returning false */ appendstate->as_whichplan = 0; - return FALSE; + return false; } else if (whichplan >= appendstate->as_nplans) { @@ -99,11 +99,11 @@ exec_append_initialize_next(AppendState *appendstate) * as above, end the scan if we go beyond the last scan in our list.. */ appendstate->as_whichplan = appendstate->as_nplans - 1; - return FALSE; + return false; } else { - return TRUE; + return true; } } diff --git a/src/backend/executor/nodeGroup.c b/src/backend/executor/nodeGroup.c index ab4ae24a6b..6b68835ca1 100644 --- a/src/backend/executor/nodeGroup.c +++ b/src/backend/executor/nodeGroup.c @@ -73,7 +73,7 @@ ExecGroup(PlanState *pstate) if (TupIsNull(outerslot)) { /* empty input, so return nothing */ - node->grp_done = TRUE; + node->grp_done = true; return NULL; } /* Copy tuple into firsttupleslot */ @@ -116,7 +116,7 @@ ExecGroup(PlanState *pstate) if (TupIsNull(outerslot)) { /* no more groups, so we're done */ - node->grp_done = TRUE; + node->grp_done = true; return NULL; } @@ -177,7 +177,7 @@ ExecInitGroup(Group *node, EState *estate, int eflags) grpstate->ss.ps.plan = (Plan *) node; grpstate->ss.ps.state = estate; grpstate->ss.ps.ExecProcNode = ExecGroup; - grpstate->grp_done = FALSE; + grpstate->grp_done = false; /* * create expression context @@ -246,7 +246,7 @@ ExecReScanGroup(GroupState *node) { PlanState *outerPlan = outerPlanState(node); - node->grp_done = FALSE; + node->grp_done = false; /* must clear first tuple */ ExecClearTuple(node->ss.ss_ScanTupleSlot); diff --git a/src/backend/optimizer/util/predtest.c b/src/backend/optimizer/util/predtest.c index 536d24b698..4f44e0413c 100644 --- a/src/backend/optimizer/util/predtest.c +++ b/src/backend/optimizer/util/predtest.c @@ -174,10 +174,10 @@ predicate_implied_by(List *predicate_list, List *clause_list, * in the technique and structure of the code. * * An important fine point is that truth of the clauses must imply that - * the predicate returns FALSE, not that it does not return TRUE. This + * the predicate returns false, not that it does not return true. This * is normally used to try to refute CHECK constraints, and the only * thing we can assume about a CHECK constraint is that it didn't return - * FALSE --- a NULL result isn't a violation per the SQL spec. (Someday + * false --- a NULL result isn't a violation per the SQL spec. (Someday * perhaps this code should be extended to support both "strong" and * "weak" refutation, but for now we only need "strong".) * @@ -489,7 +489,7 @@ predicate_implied_by_recurse(Node *clause, Node *predicate, * In addition, if the predicate is a NOT-clause then we can use * A R=> NOT B if: A => B * This works for several different SQL constructs that assert the non-truth - * of their argument, ie NOT, IS FALSE, IS NOT TRUE, IS UNKNOWN. + * of their argument, ie NOT, IS false, IS NOT true, IS UNKNOWN. * Unfortunately we *cannot* use * NOT A R=> B if: B => A * because this type of reasoning fails to prove that B doesn't yield NULL. @@ -692,7 +692,7 @@ predicate_refuted_by_recurse(Node *clause, Node *predicate, * If A is a strong NOT-clause, A R=> B if B equals A's arg * * We cannot make the stronger conclusion that B is refuted if B - * implies A's arg; that would only prove that B is not-TRUE, not + * implies A's arg; that would only prove that B is not-true, not * that it's not NULL either. Hence use equal() rather than * predicate_implied_by_recurse(). We could do the latter if we * ever had a need for the weak form of refutation. @@ -1048,7 +1048,7 @@ arrayexpr_cleanup_fn(PredIterInfo info) * Does the predicate implication test for a "simple clause" predicate * and a "simple clause" restriction. * - * We return TRUE if able to prove the implication, FALSE if not. + * We return true if able to prove the implication, false if not. * * We have three strategies for determining whether one simple clause * implies another: @@ -1063,7 +1063,7 @@ arrayexpr_cleanup_fn(PredIterInfo info) * NOT NULL", we can conclude that the predicate is implied if the clause is * a strict operator or function that has "foo" as an input. In this case * the clause must yield NULL when "foo" is NULL, which we can take as - * equivalent to FALSE given the context. (Again, "foo" is already known + * equivalent to false given the context. (Again, "foo" is already known * immutable, so the clause will certainly always fail.) Also, if the clause * is just "foo" (meaning it's a boolean variable), the predicate is implied * since the clause can't be true if "foo" is NULL. @@ -1116,7 +1116,7 @@ predicate_implied_by_simple_clause(Expr *predicate, Node *clause, * Does the predicate refutation test for a "simple clause" predicate * and a "simple clause" restriction. * - * We return TRUE if able to prove the refutation, FALSE if not. + * We return true if able to prove the refutation, false if not. * * Unlike the implication case, checking for equal() clauses isn't * helpful. @@ -1360,12 +1360,12 @@ static const bool BT_implies_table[6][6] = { * The predicate operator: * LT LE EQ GE GT NE */ - {TRUE, TRUE, none, none, none, TRUE}, /* LT */ - {none, TRUE, none, none, none, none}, /* LE */ - {none, TRUE, TRUE, TRUE, none, none}, /* EQ */ - {none, none, none, TRUE, none, none}, /* GE */ - {none, none, none, TRUE, TRUE, TRUE}, /* GT */ - {none, none, none, none, none, TRUE} /* NE */ + {true, true, none, none, none, true}, /* LT */ + {none, true, none, none, none, none}, /* LE */ + {none, true, true, true, none, none}, /* EQ */ + {none, none, none, true, none, none}, /* GE */ + {none, none, none, true, true, true}, /* GT */ + {none, none, none, none, none, true} /* NE */ }; static const bool BT_refutes_table[6][6] = { @@ -1373,12 +1373,12 @@ static const bool BT_refutes_table[6][6] = { * The predicate operator: * LT LE EQ GE GT NE */ - {none, none, TRUE, TRUE, TRUE, none}, /* LT */ - {none, none, none, none, TRUE, none}, /* LE */ - {TRUE, none, none, none, TRUE, TRUE}, /* EQ */ - {TRUE, none, none, none, none, none}, /* GE */ - {TRUE, TRUE, TRUE, none, none, none}, /* GT */ - {none, none, TRUE, none, none, none} /* NE */ + {none, none, true, true, true, none}, /* LT */ + {none, none, none, none, true, none}, /* LE */ + {true, none, none, none, true, true}, /* EQ */ + {true, none, none, none, none, none}, /* GE */ + {true, true, true, none, none, none}, /* GT */ + {none, none, true, none, none, none} /* NE */ }; static const StrategyNumber BT_implic_table[6][6] = { @@ -1417,7 +1417,7 @@ static const StrategyNumber BT_refute_table[6][6] = { * When refute_it == false, we want to prove the predicate true; * when refute_it == true, we want to prove the predicate false. * (There is enough common code to justify handling these two cases - * in one routine.) We return TRUE if able to make the proof, FALSE + * in one routine.) We return true if able to make the proof, false * if not able to prove it. * * We can make proofs involving several expression forms (here "foo" and "bar" @@ -1661,7 +1661,7 @@ operator_predicate_proof(Expr *predicate, Node *clause, bool refute_it) * Assuming that EXPR1 clause_op EXPR2 is true, try to prove or refute * EXPR1 pred_op EXPR2. * - * Return TRUE if able to make the proof, false if not able to prove it. + * Return true if able to make the proof, false if not able to prove it. */ static bool operator_same_subexprs_proof(Oid pred_op, Oid clause_op, bool refute_it) diff --git a/src/backend/parser/gram.y b/src/backend/parser/gram.y index 7d0de99baf..ec5ce78827 100644 --- a/src/backend/parser/gram.y +++ b/src/backend/parser/gram.y @@ -1005,7 +1005,7 @@ AlterOptRoleElem: } | INHERIT { - $$ = makeDefElem("inherit", (Node *)makeInteger(TRUE), @1); + $$ = makeDefElem("inherit", (Node *)makeInteger(true), @1); } | CONNECTION LIMIT SignedIconst { @@ -1028,36 +1028,36 @@ AlterOptRoleElem: * size of the main parser. */ if (strcmp($1, "superuser") == 0) - $$ = makeDefElem("superuser", (Node *)makeInteger(TRUE), @1); + $$ = makeDefElem("superuser", (Node *)makeInteger(true), @1); else if (strcmp($1, "nosuperuser") == 0) - $$ = makeDefElem("superuser", (Node *)makeInteger(FALSE), @1); + $$ = makeDefElem("superuser", (Node *)makeInteger(false), @1); else if (strcmp($1, "createrole") == 0) - $$ = makeDefElem("createrole", (Node *)makeInteger(TRUE), @1); + $$ = makeDefElem("createrole", (Node *)makeInteger(true), @1); else if (strcmp($1, "nocreaterole") == 0) - $$ = makeDefElem("createrole", (Node *)makeInteger(FALSE), @1); + $$ = makeDefElem("createrole", (Node *)makeInteger(false), @1); else if (strcmp($1, "replication") == 0) - $$ = makeDefElem("isreplication", (Node *)makeInteger(TRUE), @1); + $$ = makeDefElem("isreplication", (Node *)makeInteger(true), @1); else if (strcmp($1, "noreplication") == 0) - $$ = makeDefElem("isreplication", (Node *)makeInteger(FALSE), @1); + $$ = makeDefElem("isreplication", (Node *)makeInteger(false), @1); else if (strcmp($1, "createdb") == 0) - $$ = makeDefElem("createdb", (Node *)makeInteger(TRUE), @1); + $$ = makeDefElem("createdb", (Node *)makeInteger(true), @1); else if (strcmp($1, "nocreatedb") == 0) - $$ = makeDefElem("createdb", (Node *)makeInteger(FALSE), @1); + $$ = makeDefElem("createdb", (Node *)makeInteger(false), @1); else if (strcmp($1, "login") == 0) - $$ = makeDefElem("canlogin", (Node *)makeInteger(TRUE), @1); + $$ = makeDefElem("canlogin", (Node *)makeInteger(true), @1); else if (strcmp($1, "nologin") == 0) - $$ = makeDefElem("canlogin", (Node *)makeInteger(FALSE), @1); + $$ = makeDefElem("canlogin", (Node *)makeInteger(false), @1); else if (strcmp($1, "bypassrls") == 0) - $$ = makeDefElem("bypassrls", (Node *)makeInteger(TRUE), @1); + $$ = makeDefElem("bypassrls", (Node *)makeInteger(true), @1); else if (strcmp($1, "nobypassrls") == 0) - $$ = makeDefElem("bypassrls", (Node *)makeInteger(FALSE), @1); + $$ = makeDefElem("bypassrls", (Node *)makeInteger(false), @1); else if (strcmp($1, "noinherit") == 0) { /* * Note that INHERIT is a keyword, so it's handled by main parser, but * NOINHERIT is handled here. */ - $$ = makeDefElem("inherit", (Node *)makeInteger(FALSE), @1); + $$ = makeDefElem("inherit", (Node *)makeInteger(false), @1); } else ereport(ERROR, @@ -1190,21 +1190,21 @@ DropRoleStmt: DROP ROLE role_list { DropRoleStmt *n = makeNode(DropRoleStmt); - n->missing_ok = FALSE; + n->missing_ok = false; n->roles = $3; $$ = (Node *)n; } | DROP ROLE IF_P EXISTS role_list { DropRoleStmt *n = makeNode(DropRoleStmt); - n->missing_ok = TRUE; + n->missing_ok = true; n->roles = $5; $$ = (Node *)n; } | DROP USER role_list { DropRoleStmt *n = makeNode(DropRoleStmt); - n->missing_ok = FALSE; + n->missing_ok = false; n->roles = $3; $$ = (Node *)n; } @@ -1212,20 +1212,20 @@ DropRoleStmt: { DropRoleStmt *n = makeNode(DropRoleStmt); n->roles = $5; - n->missing_ok = TRUE; + n->missing_ok = true; $$ = (Node *)n; } | DROP GROUP_P role_list { DropRoleStmt *n = makeNode(DropRoleStmt); - n->missing_ok = FALSE; + n->missing_ok = false; n->roles = $3; $$ = (Node *)n; } | DROP GROUP_P IF_P EXISTS role_list { DropRoleStmt *n = makeNode(DropRoleStmt); - n->missing_ok = TRUE; + n->missing_ok = true; n->roles = $5; $$ = (Node *)n; } @@ -1730,8 +1730,8 @@ constraints_set_list: ; constraints_set_mode: - DEFERRED { $$ = TRUE; } - | IMMEDIATE { $$ = FALSE; } + DEFERRED { $$ = true; } + | IMMEDIATE { $$ = false; } ; @@ -2156,7 +2156,7 @@ alter_table_cmd: n->subtype = AT_DropColumn; n->name = $5; n->behavior = $6; - n->missing_ok = TRUE; + n->missing_ok = true; $$ = (Node *)n; } /* ALTER TABLE <name> DROP [COLUMN] <colname> [RESTRICT|CASCADE] */ @@ -2166,7 +2166,7 @@ alter_table_cmd: n->subtype = AT_DropColumn; n->name = $3; n->behavior = $4; - n->missing_ok = FALSE; + n->missing_ok = false; $$ = (Node *)n; } /* @@ -2234,7 +2234,7 @@ alter_table_cmd: n->subtype = AT_DropConstraint; n->name = $5; n->behavior = $6; - n->missing_ok = TRUE; + n->missing_ok = true; $$ = (Node *)n; } /* ALTER TABLE <name> DROP CONSTRAINT <name> [RESTRICT|CASCADE] */ @@ -2244,7 +2244,7 @@ alter_table_cmd: n->subtype = AT_DropConstraint; n->name = $3; n->behavior = $4; - n->missing_ok = FALSE; + n->missing_ok = false; $$ = (Node *)n; } /* ALTER TABLE <name> SET WITH OIDS */ @@ -2739,7 +2739,7 @@ alter_type_cmd: n->subtype = AT_DropColumn; n->name = $5; n->behavior = $6; - n->missing_ok = TRUE; + n->missing_ok = true; $$ = (Node *)n; } /* ALTER TYPE <name> DROP ATTRIBUTE <attname> [RESTRICT|CASCADE] */ @@ -2749,7 +2749,7 @@ alter_type_cmd: n->subtype = AT_DropColumn; n->name = $3; n->behavior = $4; - n->missing_ok = FALSE; + n->missing_ok = false; $$ = (Node *)n; } /* ALTER TYPE <name> ALTER ATTRIBUTE <attname> [SET DATA] TYPE <typename> [RESTRICT|CASCADE] */ @@ -2869,13 +2869,13 @@ CopyStmt: COPY opt_binary qualified_name opt_column_list opt_oids ; copy_from: - FROM { $$ = TRUE; } - | TO { $$ = FALSE; } + FROM { $$ = true; } + | TO { $$ = false; } ; opt_program: - PROGRAM { $$ = TRUE; } - | /* EMPTY */ { $$ = FALSE; } + PROGRAM { $$ = true; } + | /* EMPTY */ { $$ = false; } ; /* @@ -2906,11 +2906,11 @@ copy_opt_item: } | OIDS { - $$ = makeDefElem("oids", (Node *)makeInteger(TRUE), @1); + $$ = makeDefElem("oids", (Node *)makeInteger(true), @1); } | FREEZE { - $$ = makeDefElem("freeze", (Node *)makeInteger(TRUE), @1); + $$ = makeDefElem("freeze", (Node *)makeInteger(true), @1); } | DELIMITER opt_as Sconst { @@ -2926,7 +2926,7 @@ copy_opt_item: } | HEADER_P { - $$ = makeDefElem("header", (Node *)makeInteger(TRUE), @1); + $$ = makeDefElem("header", (Node *)makeInteger(true), @1); } | QUOTE opt_as Sconst { @@ -2971,7 +2971,7 @@ opt_binary: opt_oids: WITH OIDS { - $$ = makeDefElem("oids", (Node *)makeInteger(TRUE), @1); + $$ = makeDefElem("oids", (Node *)makeInteger(true), @1); } | /*EMPTY*/ { $$ = NULL; } ; @@ -3625,8 +3625,8 @@ ConstraintElem: } ; -opt_no_inherit: NO INHERIT { $$ = TRUE; } - | /* EMPTY */ { $$ = FALSE; } +opt_no_inherit: NO INHERIT { $$ = true; } + | /* EMPTY */ { $$ = false; } ; opt_column_list: @@ -3903,9 +3903,9 @@ create_as_target: ; opt_with_data: - WITH DATA_P { $$ = TRUE; } - | WITH NO DATA_P { $$ = FALSE; } - | /*EMPTY*/ { $$ = TRUE; } + WITH DATA_P { $$ = true; } + | WITH NO DATA_P { $$ = false; } + | /*EMPTY*/ { $$ = true; } ; @@ -4056,11 +4056,11 @@ SeqOptElem: AS SimpleTypename } | CYCLE { - $$ = makeDefElem("cycle", (Node *)makeInteger(TRUE), @1); + $$ = makeDefElem("cycle", (Node *)makeInteger(true), @1); } | NO CYCLE { - $$ = makeDefElem("cycle", (Node *)makeInteger(FALSE), @1); + $$ = makeDefElem("cycle", (Node *)makeInteger(false), @1); } | INCREMENT opt_by NumericOnly { @@ -4160,8 +4160,8 @@ CreatePLangStmt: ; opt_trusted: - TRUSTED { $$ = TRUE; } - | /*EMPTY*/ { $$ = FALSE; } + TRUSTED { $$ = true; } + | /*EMPTY*/ { $$ = false; } ; /* This ought to be just func_name, but that causes reduce/reduce conflicts @@ -4312,7 +4312,7 @@ create_extension_opt_item: } | CASCADE { - $$ = makeDefElem("cascade", (Node *)makeInteger(TRUE), @1); + $$ = makeDefElem("cascade", (Node *)makeInteger(true), @1); } ; @@ -5176,9 +5176,9 @@ CreateTrigStmt: n->columns = (List *) lsecond($5); n->whenClause = $10; n->transitionRels = $8; - n->isconstraint = FALSE; - n->deferrable = FALSE; - n->initdeferred = FALSE; + n->isconstraint = false; + n->deferrable = false; + n->initdeferred = false; n->constrrel = NULL; $$ = (Node *)n; } @@ -5192,13 +5192,13 @@ CreateTrigStmt: n->relation = $8; n->funcname = $17; n->args = $19; - n->row = TRUE; + n->row = true; n->timing = TRIGGER_TYPE_AFTER; n->events = intVal(linitial($6)); n->columns = (List *) lsecond($6); n->whenClause = $14; n->transitionRels = NIL; - n->isconstraint = TRUE; + n->isconstraint = true; processCASbits($10, @10, "TRIGGER", &n->deferrable, &n->initdeferred, NULL, NULL, yyscanner); @@ -5272,12 +5272,12 @@ TriggerTransition: ; TransitionOldOrNew: - NEW { $$ = TRUE; } - | OLD { $$ = FALSE; } + NEW { $$ = true; } + | OLD { $$ = false; } ; TransitionRowOrTable: - TABLE { $$ = TRUE; } + TABLE { $$ = true; } /* * According to the standard, lack of a keyword here implies ROW. * Support for that would require prohibiting ROW entirely here, @@ -5286,7 +5286,7 @@ TransitionRowOrTable: * next token. Requiring ROW seems cleanest and easiest to * explain. */ - | ROW { $$ = FALSE; } + | ROW { $$ = false; } ; TransitionRelName: @@ -5304,7 +5304,7 @@ TriggerForSpec: * If ROW/STATEMENT not specified, default to * STATEMENT, per SQL */ - $$ = FALSE; + $$ = false; } ; @@ -5314,8 +5314,8 @@ TriggerForOptEach: ; TriggerForType: - ROW { $$ = TRUE; } - | STATEMENT { $$ = FALSE; } + ROW { $$ = true; } + | STATEMENT { $$ = false; } ; TriggerWhen: @@ -5466,7 +5466,7 @@ CreateAssertStmt: CreateTrigStmt *n = makeNode(CreateTrigStmt); n->trigname = $3; n->args = list_make1($6); - n->isconstraint = TRUE; + n->isconstraint = true; processCASbits($8, @8, "ASSERTION", &n->deferrable, &n->initdeferred, NULL, NULL, yyscanner); @@ -5846,8 +5846,8 @@ opclass_item: } ; -opt_default: DEFAULT { $$ = TRUE; } - | /*EMPTY*/ { $$ = FALSE; } +opt_default: DEFAULT { $$ = true; } + | /*EMPTY*/ { $$ = false; } ; opt_opfamily: FAMILY any_name { $$ = $2; } @@ -5871,9 +5871,9 @@ opt_recheck: RECHECK errmsg("RECHECK is no longer required"), errhint("Update your data type."), parser_errposition(@1))); - $$ = TRUE; + $$ = true; } - | /*EMPTY*/ { $$ = FALSE; } + | /*EMPTY*/ { $$ = false; } ; @@ -6021,7 +6021,7 @@ DropStmt: DROP drop_type_any_name IF_P EXISTS any_name_list opt_drop_behavior { DropStmt *n = makeNode(DropStmt); n->removeType = $2; - n->missing_ok = TRUE; + n->missing_ok = true; n->objects = $5; n->behavior = $6; n->concurrent = false; @@ -6031,7 +6031,7 @@ DropStmt: DROP drop_type_any_name IF_P EXISTS any_name_list opt_drop_behavior { DropStmt *n = makeNode(DropStmt); n->removeType = $2; - n->missing_ok = FALSE; + n->missing_ok = false; n->objects = $3; n->behavior = $4; n->concurrent = false; @@ -6041,7 +6041,7 @@ DropStmt: DROP drop_type_any_name IF_P EXISTS any_name_list opt_drop_behavior { DropStmt *n = makeNode(DropStmt); n->removeType = $2; - n->missing_ok = TRUE; + n->missing_ok = true; n->objects = $5; n->behavior = $6; n->concurrent = false; @@ -6051,7 +6051,7 @@ DropStmt: DROP drop_type_any_name IF_P EXISTS any_name_list opt_drop_behavior { DropStmt *n = makeNode(DropStmt); n->removeType = $2; - n->missing_ok = FALSE; + n->missing_ok = false; n->objects = $3; n->behavior = $4; n->concurrent = false; @@ -6081,7 +6081,7 @@ DropStmt: DROP drop_type_any_name IF_P EXISTS any_name_list opt_drop_behavior { DropStmt *n = makeNode(DropStmt); n->removeType = OBJECT_TYPE; - n->missing_ok = FALSE; + n->missing_ok = false; n->objects = $3; n->behavior = $4; n->concurrent = false; @@ -6091,7 +6091,7 @@ DropStmt: DROP drop_type_any_name IF_P EXISTS any_name_list opt_drop_behavior { DropStmt *n = makeNode(DropStmt); n->removeType = OBJECT_TYPE; - n->missing_ok = TRUE; + n->missing_ok = true; n->objects = $5; n->behavior = $6; n->concurrent = false; @@ -6101,7 +6101,7 @@ DropStmt: DROP drop_type_any_name IF_P EXISTS any_name_list opt_drop_behavior { DropStmt *n = makeNode(DropStmt); n->removeType = OBJECT_DOMAIN; - n->missing_ok = FALSE; + n->missing_ok = false; n->objects = $3; n->behavior = $4; n->concurrent = false; @@ -6111,7 +6111,7 @@ DropStmt: DROP drop_type_any_name IF_P EXISTS any_name_list opt_drop_behavior { DropStmt *n = makeNode(DropStmt); n->removeType = OBJECT_DOMAIN; - n->missing_ok = TRUE; + n->missing_ok = true; n->objects = $5; n->behavior = $6; n->concurrent = false; @@ -6121,7 +6121,7 @@ DropStmt: DROP drop_type_any_name IF_P EXISTS any_name_list opt_drop_behavior { DropStmt *n = makeNode(DropStmt); n->removeType = OBJECT_INDEX; - n->missing_ok = FALSE; + n->missing_ok = false; n->objects = $4; n->behavior = $5; n->concurrent = true; @@ -6131,7 +6131,7 @@ DropStmt: DROP drop_type_any_name IF_P EXISTS any_name_list opt_drop_behavior { DropStmt *n = makeNode(DropStmt); n->removeType = OBJECT_INDEX; - n->missing_ok = TRUE; + n->missing_ok = true; n->objects = $6; n->behavior = $7; n->concurrent = true; @@ -6553,13 +6553,13 @@ security_label: Sconst { $$ = $1; } FetchStmt: FETCH fetch_args { FetchStmt *n = (FetchStmt *) $2; - n->ismove = FALSE; + n->ismove = false; $$ = (Node *)n; } | MOVE fetch_args { FetchStmt *n = (FetchStmt *) $2; - n->ismove = TRUE; + n->ismove = true; $$ = (Node *)n; } ; @@ -6969,8 +6969,8 @@ grantee: opt_grant_grant_option: - WITH GRANT OPTION { $$ = TRUE; } - | /*EMPTY*/ { $$ = FALSE; } + WITH GRANT OPTION { $$ = true; } + | /*EMPTY*/ { $$ = false; } ; /***************************************************************************** @@ -7015,8 +7015,8 @@ RevokeRoleStmt: } ; -opt_grant_admin_option: WITH ADMIN OPTION { $$ = TRUE; } - | /*EMPTY*/ { $$ = FALSE; } +opt_grant_admin_option: WITH ADMIN OPTION { $$ = true; } + | /*EMPTY*/ { $$ = false; } ; opt_granted_by: GRANTED BY RoleSpec { $$ = $3; } @@ -7179,13 +7179,13 @@ IndexStmt: CREATE opt_unique INDEX opt_concurrently opt_index_name ; opt_unique: - UNIQUE { $$ = TRUE; } - | /*EMPTY*/ { $$ = FALSE; } + UNIQUE { $$ = true; } + | /*EMPTY*/ { $$ = false; } ; opt_concurrently: - CONCURRENTLY { $$ = TRUE; } - | /*EMPTY*/ { $$ = FALSE; } + CONCURRENTLY { $$ = true; } + | /*EMPTY*/ { $$ = false; } ; opt_index_name: @@ -7313,8 +7313,8 @@ CreateFunctionStmt: ; opt_or_replace: - OR REPLACE { $$ = TRUE; } - | /*EMPTY*/ { $$ = FALSE; } + OR REPLACE { $$ = true; } + | /*EMPTY*/ { $$ = false; } ; func_args: '(' func_args_list ')' { $$ = $2; } @@ -7483,7 +7483,7 @@ func_type: Typename { $$ = $1; } { $$ = makeTypeNameFromNameList(lcons(makeString($2), $3)); $$->pct_type = true; - $$->setof = TRUE; + $$->setof = true; $$->location = @2; } ; @@ -7599,15 +7599,15 @@ createfunc_opt_list: common_func_opt_item: CALLED ON NULL_P INPUT_P { - $$ = makeDefElem("strict", (Node *)makeInteger(FALSE), @1); + $$ = makeDefElem("strict", (Node *)makeInteger(false), @1); } | RETURNS NULL_P ON NULL_P INPUT_P { - $$ = makeDefElem("strict", (Node *)makeInteger(TRUE), @1); + $$ = makeDefElem("strict", (Node *)makeInteger(true), @1); } | STRICT_P { - $$ = makeDefElem("strict", (Node *)makeInteger(TRUE), @1); + $$ = makeDefElem("strict", (Node *)makeInteger(true), @1); } | IMMUTABLE { @@ -7623,27 +7623,27 @@ common_func_opt_item: } | EXTERNAL SECURITY DEFINER { - $$ = makeDefElem("security", (Node *)makeInteger(TRUE), @1); + $$ = makeDefElem("security", (Node *)makeInteger(true), @1); } | EXTERNAL SECURITY INVOKER { - $$ = makeDefElem("security", (Node *)makeInteger(FALSE), @1); + $$ = makeDefElem("security", (Node *)makeInteger(false), @1); } | SECURITY DEFINER { - $$ = makeDefElem("security", (Node *)makeInteger(TRUE), @1); + $$ = makeDefElem("security", (Node *)makeInteger(true), @1); } | SECURITY INVOKER { - $$ = makeDefElem("security", (Node *)makeInteger(FALSE), @1); + $$ = makeDefElem("security", (Node *)makeInteger(false), @1); } | LEAKPROOF { - $$ = makeDefElem("leakproof", (Node *)makeInteger(TRUE), @1); + $$ = makeDefElem("leakproof", (Node *)makeInteger(true), @1); } | NOT LEAKPROOF { - $$ = makeDefElem("leakproof", (Node *)makeInteger(FALSE), @1); + $$ = makeDefElem("leakproof", (Node *)makeInteger(false), @1); } | COST NumericOnly { @@ -7679,7 +7679,7 @@ createfunc_opt_item: } | WINDOW { - $$ = makeDefElem("window", (Node *)makeInteger(TRUE), @1); + $$ = makeDefElem("window", (Node *)makeInteger(true), @1); } | common_func_opt_item { @@ -7968,8 +7968,8 @@ DropCastStmt: DROP CAST opt_if_exists '(' Typename AS Typename ')' opt_drop_beha } ; -opt_if_exists: IF_P EXISTS { $$ = TRUE; } - | /*EMPTY*/ { $$ = FALSE; } +opt_if_exists: IF_P EXISTS { $$ = true; } + | /*EMPTY*/ { $$ = false; } ; @@ -8097,7 +8097,7 @@ AlterTblSpcStmt: makeNode(AlterTableSpaceOptionsStmt); n->tablespacename = $3; n->options = $5; - n->isReset = FALSE; + n->isReset = false; $$ = (Node *)n; } | ALTER TABLESPACE name RESET reloptions @@ -8106,7 +8106,7 @@ AlterTblSpcStmt: makeNode(AlterTableSpaceOptionsStmt); n->tablespacename = $3; n->options = $5; - n->isReset = TRUE; + n->isReset = true; $$ = (Node *)n; } ; @@ -9133,7 +9133,7 @@ CreatePublicationStmt: n->tables = (List *)$4; /* FOR ALL TABLES */ else - n->for_all_tables = TRUE; + n->for_all_tables = true; } $$ = (Node *)n; } @@ -9151,7 +9151,7 @@ publication_for_tables: } | FOR ALL TABLES { - $$ = (Node *) makeInteger(TRUE); + $$ = (Node *) makeInteger(true); } ; @@ -9286,7 +9286,7 @@ AlterSubscriptionStmt: n->kind = ALTER_SUBSCRIPTION_ENABLED; n->subname = $3; n->options = list_make1(makeDefElem("enabled", - (Node *)makeInteger(TRUE), @1)); + (Node *)makeInteger(true), @1)); $$ = (Node *)n; } | ALTER SUBSCRIPTION name DISABLE_P @@ -9296,7 +9296,7 @@ AlterSubscriptionStmt: n->kind = ALTER_SUBSCRIPTION_ENABLED; n->subname = $3; n->options = list_make1(makeDefElem("enabled", - (Node *)makeInteger(FALSE), @1)); + (Node *)makeInteger(false), @1)); $$ = (Node *)n; } ; @@ -9389,9 +9389,9 @@ event: SELECT { $$ = CMD_SELECT; } ; opt_instead: - INSTEAD { $$ = TRUE; } - | ALSO { $$ = FALSE; } - | /*EMPTY*/ { $$ = FALSE; } + INSTEAD { $$ = true; } + | ALSO { $$ = false; } + | /*EMPTY*/ { $$ = false; } ; @@ -9567,16 +9567,16 @@ transaction_mode_item: makeStringConst($3, @3), @1); } | READ ONLY { $$ = makeDefElem("transaction_read_only", - makeIntConst(TRUE, @1), @1); } + makeIntConst(true, @1), @1); } | READ WRITE { $$ = makeDefElem("transaction_read_only", - makeIntConst(FALSE, @1), @1); } + makeIntConst(false, @1), @1); } | DEFERRABLE { $$ = makeDefElem("transaction_deferrable", - makeIntConst(TRUE, @1), @1); } + makeIntConst(true, @1), @1); } | NOT DEFERRABLE { $$ = makeDefElem("transaction_deferrable", - makeIntConst(FALSE, @1), @1); } + makeIntConst(false, @1), @1); } ; /* Syntax with commas is SQL-spec, without commas is Postgres historical */ @@ -9815,14 +9815,14 @@ DropdbStmt: DROP DATABASE database_name { DropdbStmt *n = makeNode(DropdbStmt); n->dbname = $3; - n->missing_ok = FALSE; + n->missing_ok = false; $$ = (Node *)n; } | DROP DATABASE IF_P EXISTS database_name { DropdbStmt *n = makeNode(DropdbStmt); n->dbname = $5; - n->missing_ok = TRUE; + n->missing_ok = true; $$ = (Node *)n; } ; @@ -10229,16 +10229,16 @@ analyze_keyword: ; opt_verbose: - VERBOSE { $$ = TRUE; } - | /*EMPTY*/ { $$ = FALSE; } + VERBOSE { $$ = true; } + | /*EMPTY*/ { $$ = false; } ; -opt_full: FULL { $$ = TRUE; } - | /*EMPTY*/ { $$ = FALSE; } +opt_full: FULL { $$ = true; } + | /*EMPTY*/ { $$ = false; } ; -opt_freeze: FREEZE { $$ = TRUE; } - | /*EMPTY*/ { $$ = FALSE; } +opt_freeze: FREEZE { $$ = true; } + | /*EMPTY*/ { $$ = false; } ; opt_name_list: @@ -10636,8 +10636,8 @@ lock_type: ACCESS SHARE { $$ = AccessShareLock; } | ACCESS EXCLUSIVE { $$ = AccessExclusiveLock; } ; -opt_nowait: NOWAIT { $$ = TRUE; } - | /*EMPTY*/ { $$ = FALSE; } +opt_nowait: NOWAIT { $$ = true; } + | /*EMPTY*/ { $$ = false; } ; opt_nowait_or_skip: @@ -11104,9 +11104,9 @@ opt_table: TABLE {} ; all_or_distinct: - ALL { $$ = TRUE; } - | DISTINCT { $$ = FALSE; } - | /*EMPTY*/ { $$ = FALSE; } + ALL { $$ = true; } + | DISTINCT { $$ = false; } + | /*EMPTY*/ { $$ = false; } ; /* We use (NIL) as a placeholder to indicate that all target expressions @@ -11535,7 +11535,7 @@ joined_table: /* CROSS JOIN is same as unqualified inner join */ JoinExpr *n = makeNode(JoinExpr); n->jointype = JOIN_INNER; - n->isNatural = FALSE; + n->isNatural = false; n->larg = $1; n->rarg = $4; n->usingClause = NIL; @@ -11546,7 +11546,7 @@ joined_table: { JoinExpr *n = makeNode(JoinExpr); n->jointype = $2; - n->isNatural = FALSE; + n->isNatural = false; n->larg = $1; n->rarg = $4; if ($5 != NULL && IsA($5, List)) @@ -11560,7 +11560,7 @@ joined_table: /* letting join_type reduce to empty doesn't work */ JoinExpr *n = makeNode(JoinExpr); n->jointype = JOIN_INNER; - n->isNatural = FALSE; + n->isNatural = false; n->larg = $1; n->rarg = $3; if ($4 != NULL && IsA($4, List)) @@ -11573,7 +11573,7 @@ joined_table: { JoinExpr *n = makeNode(JoinExpr); n->jointype = $3; - n->isNatural = TRUE; + n->isNatural = true; n->larg = $1; n->rarg = $5; n->usingClause = NIL; /* figure out which columns later... */ @@ -11585,7 +11585,7 @@ joined_table: /* letting join_type reduce to empty doesn't work */ JoinExpr *n = makeNode(JoinExpr); n->jointype = JOIN_INNER; - n->isNatural = TRUE; + n->isNatural = true; n->larg = $1; n->rarg = $4; n->usingClause = NIL; /* figure out which columns later... */ @@ -12055,7 +12055,7 @@ Typename: SimpleTypename opt_array_bounds { $$ = $2; $$->arrayBounds = $3; - $$->setof = TRUE; + $$->setof = true; } /* SQL standard syntax, currently only one-dimensional */ | SimpleTypename ARRAY '[' Iconst ']' @@ -12067,7 +12067,7 @@ Typename: SimpleTypename opt_array_bounds { $$ = $2; $$->arrayBounds = list_make1(makeInteger($5)); - $$->setof = TRUE; + $$->setof = true; } | SimpleTypename ARRAY { @@ -12078,7 +12078,7 @@ Typename: SimpleTypename opt_array_bounds { $$ = $2; $$->arrayBounds = list_make1(makeInteger(-1)); - $$->setof = TRUE; + $$->setof = true; } ; @@ -12365,8 +12365,8 @@ character: CHARACTER opt_varying ; opt_varying: - VARYING { $$ = TRUE; } - | /*EMPTY*/ { $$ = FALSE; } + VARYING { $$ = true; } + | /*EMPTY*/ { $$ = false; } ; /* @@ -12418,9 +12418,9 @@ ConstInterval: ; opt_timezone: - WITH_LA TIME ZONE { $$ = TRUE; } - | WITHOUT TIME ZONE { $$ = FALSE; } - | /*EMPTY*/ { $$ = FALSE; } + WITH_LA TIME ZONE { $$ = true; } + | WITHOUT TIME ZONE { $$ = false; } + | /*EMPTY*/ { $$ = false; } ; opt_interval: @@ -13181,14 +13181,14 @@ func_application: func_name '(' ')' | func_name '(' VARIADIC func_arg_expr opt_sort_clause ')' { FuncCall *n = makeFuncCall($1, list_make1($4), @1); - n->func_variadic = TRUE; + n->func_variadic = true; n->agg_order = $5; $$ = (Node *)n; } | func_name '(' func_arg_list ',' VARIADIC func_arg_expr opt_sort_clause ')' { FuncCall *n = makeFuncCall($1, lappend($3, $6), @1); - n->func_variadic = TRUE; + n->func_variadic = true; n->agg_order = $7; $$ = (Node *)n; } @@ -13206,7 +13206,7 @@ func_application: func_name '(' ')' { FuncCall *n = makeFuncCall($1, $4, @1); n->agg_order = $5; - n->agg_distinct = TRUE; + n->agg_distinct = true; $$ = (Node *)n; } | func_name '(' '*' ')' @@ -13222,7 +13222,7 @@ func_application: func_name '(' ')' * really was. */ FuncCall *n = makeFuncCall($1, NIL, @1); - n->agg_star = TRUE; + n->agg_star = true; $$ = (Node *)n; } ; @@ -13266,7 +13266,7 @@ func_expr: func_application within_group_clause filter_clause over_clause errmsg("cannot use VARIADIC with WITHIN GROUP"), parser_errposition(@2))); n->agg_order = $2; - n->agg_within_group = TRUE; + n->agg_within_group = true; } n->agg_filter = $3; n->over = $4; @@ -13556,9 +13556,9 @@ document_or_content: DOCUMENT_P { $$ = XMLOPTION_DOCUMENT; } | CONTENT_P { $$ = XMLOPTION_CONTENT; } ; -xml_whitespace_option: PRESERVE WHITESPACE_P { $$ = TRUE; } - | STRIP_P WHITESPACE_P { $$ = FALSE; } - | /*EMPTY*/ { $$ = FALSE; } +xml_whitespace_option: PRESERVE WHITESPACE_P { $$ = true; } + | STRIP_P WHITESPACE_P { $$ = false; } + | /*EMPTY*/ { $$ = false; } ; /* We allow several variants for SQL and other compatibility. */ @@ -14430,11 +14430,11 @@ AexprConst: Iconst } | TRUE_P { - $$ = makeBoolAConst(TRUE, @1); + $$ = makeBoolAConst(true, @1); } | FALSE_P { - $$ = makeBoolAConst(FALSE, @1); + $$ = makeBoolAConst(false, @1); } | NULL_P { diff --git a/src/backend/parser/parse_utilcmd.c b/src/backend/parser/parse_utilcmd.c index 495ba3dffc..abc08ba9dd 100644 --- a/src/backend/parser/parse_utilcmd.c +++ b/src/backend/parser/parse_utilcmd.c @@ -627,7 +627,7 @@ transformColumnDefinition(CreateStmtContext *cxt, ColumnDef *column) column->colname, cxt->relation->relname), parser_errposition(cxt->pstate, constraint->location))); - column->is_not_null = FALSE; + column->is_not_null = false; saw_nullable = true; break; @@ -639,7 +639,7 @@ transformColumnDefinition(CreateStmtContext *cxt, ColumnDef *column) column->colname, cxt->relation->relname), parser_errposition(cxt->pstate, constraint->location))); - column->is_not_null = TRUE; + column->is_not_null = true; saw_nullable = true; break; @@ -679,7 +679,7 @@ transformColumnDefinition(CreateStmtContext *cxt, ColumnDef *column) column->identity = constraint->generated_when; saw_identity = true; - column->is_not_null = TRUE; + column->is_not_null = true; break; } @@ -2007,7 +2007,7 @@ transformIndexConstraint(Constraint *constraint, CreateStmtContext *cxt) { /* found column in the new table; force it to be NOT NULL */ if (constraint->contype == CONSTR_PRIMARY) - column->is_not_null = TRUE; + column->is_not_null = true; } else if (SystemAttributeByName(key, cxt->hasoids) != NULL) { diff --git a/src/backend/replication/repl_gram.y b/src/backend/replication/repl_gram.y index ec047c827c..c2e8479820 100644 --- a/src/backend/replication/repl_gram.y +++ b/src/backend/replication/repl_gram.y @@ -180,22 +180,22 @@ base_backup_opt: | K_PROGRESS { $$ = makeDefElem("progress", - (Node *)makeInteger(TRUE), -1); + (Node *)makeInteger(true), -1); } | K_FAST { $$ = makeDefElem("fast", - (Node *)makeInteger(TRUE), -1); + (Node *)makeInteger(true), -1); } | K_WAL { $$ = makeDefElem("wal", - (Node *)makeInteger(TRUE), -1); + (Node *)makeInteger(true), -1); } | K_NOWAIT { $$ = makeDefElem("nowait", - (Node *)makeInteger(TRUE), -1); + (Node *)makeInteger(true), -1); } | K_MAX_RATE UCONST { @@ -205,7 +205,7 @@ base_backup_opt: | K_TABLESPACE_MAP { $$ = makeDefElem("tablespace_map", - (Node *)makeInteger(TRUE), -1); + (Node *)makeInteger(true), -1); } ; @@ -246,22 +246,22 @@ create_slot_opt: K_EXPORT_SNAPSHOT { $$ = makeDefElem("export_snapshot", - (Node *)makeInteger(TRUE), -1); + (Node *)makeInteger(true), -1); } | K_NOEXPORT_SNAPSHOT { $$ = makeDefElem("export_snapshot", - (Node *)makeInteger(FALSE), -1); + (Node *)makeInteger(false), -1); } | K_USE_SNAPSHOT { $$ = makeDefElem("use_snapshot", - (Node *)makeInteger(TRUE), -1); + (Node *)makeInteger(true), -1); } | K_RESERVE_WAL { $$ = makeDefElem("reserve_wal", - (Node *)makeInteger(TRUE), -1); + (Node *)makeInteger(true), -1); } ; diff --git a/src/backend/storage/buffer/bufmgr.c b/src/backend/storage/buffer/bufmgr.c index 15795b0c5a..572f413d6e 100644 --- a/src/backend/storage/buffer/bufmgr.c +++ b/src/backend/storage/buffer/bufmgr.c @@ -975,7 +975,7 @@ ReadBuffer_common(SMgrRelation smgr, char relpersistence, ForkNumber forkNum, * * The returned buffer is pinned and is already marked as holding the * desired page. If it already did have the desired page, *foundPtr is - * set TRUE. Otherwise, *foundPtr is set FALSE and the buffer is marked + * set true. Otherwise, *foundPtr is set false and the buffer is marked * as IO_IN_PROGRESS; ReadBuffer will now need to do I/O to fill it. * * *foundPtr is actually redundant with the buffer's BM_VALID flag, but @@ -1025,7 +1025,7 @@ BufferAlloc(SMgrRelation smgr, char relpersistence, ForkNumber forkNum, /* Can release the mapping lock as soon as we've pinned it */ LWLockRelease(newPartitionLock); - *foundPtr = TRUE; + *foundPtr = true; if (!valid) { @@ -1042,7 +1042,7 @@ BufferAlloc(SMgrRelation smgr, char relpersistence, ForkNumber forkNum, * If we get here, previous attempts to read the buffer must * have failed ... but we shall bravely try again. */ - *foundPtr = FALSE; + *foundPtr = false; } } @@ -1237,7 +1237,7 @@ BufferAlloc(SMgrRelation smgr, char relpersistence, ForkNumber forkNum, /* Can release the mapping lock as soon as we've pinned it */ LWLockRelease(newPartitionLock); - *foundPtr = TRUE; + *foundPtr = true; if (!valid) { @@ -1254,7 +1254,7 @@ BufferAlloc(SMgrRelation smgr, char relpersistence, ForkNumber forkNum, * If we get here, previous attempts to read the buffer * must have failed ... but we shall bravely try again. */ - *foundPtr = FALSE; + *foundPtr = false; } } @@ -1324,9 +1324,9 @@ BufferAlloc(SMgrRelation smgr, char relpersistence, ForkNumber forkNum, * read it before we did, so there's nothing left for BufferAlloc() to do. */ if (StartBufferIO(buf, true)) - *foundPtr = FALSE; + *foundPtr = false; else - *foundPtr = TRUE; + *foundPtr = true; return buf; } @@ -1564,7 +1564,7 @@ ReleaseAndReadBuffer(Buffer buffer, * * Note that ResourceOwnerEnlargeBuffers must have been done already. * - * Returns TRUE if buffer is BM_VALID, else FALSE. This provision allows + * Returns true if buffer is BM_VALID, else false. This provision allows * some callers to avoid an extra spinlock cycle. */ static bool @@ -1688,7 +1688,7 @@ PinBuffer_Locked(BufferDesc *buf) * This should be applied only to shared buffers, never local ones. * * Most but not all callers want CurrentResourceOwner to be adjusted. - * Those that don't should pass fixOwner = FALSE. + * Those that don't should pass fixOwner = false. */ static void UnpinBuffer(BufferDesc *buf, bool fixOwner) @@ -3712,7 +3712,7 @@ HoldingBufferPinThatDelaysRecovery(void) * ConditionalLockBufferForCleanup - as above, but don't wait to get the lock * * We won't loop, but just check once to see if the pin count is OK. If - * not, return FALSE with no lock held. + * not, return false with no lock held. */ bool ConditionalLockBufferForCleanup(Buffer buffer) @@ -3868,8 +3868,8 @@ WaitIO(BufferDesc *buf) * and output operations only on buffers that are BM_VALID and BM_DIRTY, * so we can always tell if the work is already done. * - * Returns TRUE if we successfully marked the buffer as I/O busy, - * FALSE if someone else already did the work. + * Returns true if we successfully marked the buffer as I/O busy, + * false if someone else already did the work. */ static bool StartBufferIO(BufferDesc *buf, bool forInput) @@ -3929,7 +3929,7 @@ StartBufferIO(BufferDesc *buf, bool forInput) * We hold the buffer's io_in_progress lock * The buffer is Pinned * - * If clear_dirty is TRUE and BM_JUST_DIRTIED is not set, we clear the + * If clear_dirty is true and BM_JUST_DIRTIED is not set, we clear the * buffer's BM_DIRTY flag. This is appropriate when terminating a * successful write. The check on BM_JUST_DIRTIED is necessary to avoid * marking the buffer clean if it was re-dirtied while we were writing. diff --git a/src/backend/storage/buffer/localbuf.c b/src/backend/storage/buffer/localbuf.c index 1d540e87e8..1930f0ee0b 100644 --- a/src/backend/storage/buffer/localbuf.c +++ b/src/backend/storage/buffer/localbuf.c @@ -145,11 +145,11 @@ LocalBufferAlloc(SMgrRelation smgr, ForkNumber forkNum, BlockNumber blockNum, ResourceOwnerRememberBuffer(CurrentResourceOwner, BufferDescriptorGetBuffer(bufHdr)); if (buf_state & BM_VALID) - *foundPtr = TRUE; + *foundPtr = true; else { /* Previous read attempt must have failed; try again */ - *foundPtr = FALSE; + *foundPtr = false; } return bufHdr; } @@ -268,7 +268,7 @@ LocalBufferAlloc(SMgrRelation smgr, ForkNumber forkNum, BlockNumber blockNum, buf_state += BUF_USAGECOUNT_ONE; pg_atomic_unlocked_write_u32(&bufHdr->state, buf_state); - *foundPtr = FALSE; + *foundPtr = false; return bufHdr; } diff --git a/src/backend/storage/ipc/shmem.c b/src/backend/storage/ipc/shmem.c index 81c291f6e3..22522676f3 100644 --- a/src/backend/storage/ipc/shmem.c +++ b/src/backend/storage/ipc/shmem.c @@ -257,7 +257,7 @@ ShmemAllocUnlocked(Size size) /* * ShmemAddrIsValid -- test if an address refers to shared memory * - * Returns TRUE if the pointer points within the shared memory segment. + * Returns true if the pointer points within the shared memory segment. */ bool ShmemAddrIsValid(const void *addr) @@ -361,7 +361,7 @@ ShmemInitHash(const char *name, /* table string name for shmem index */ * for it. If it exists already, a pointer to the existing * structure is returned. * - * Returns: pointer to the object. *foundPtr is set TRUE if the object was + * Returns: pointer to the object. *foundPtr is set true if the object was * already in the shmem index (hence, already initialized). * * Note: before Postgres 9.0, this function returned NULL for some failure @@ -388,7 +388,7 @@ ShmemInitStruct(const char *name, Size size, bool *foundPtr) /* Must be initializing a (non-standalone) backend */ Assert(shmemseghdr->index != NULL); structPtr = shmemseghdr->index; - *foundPtr = TRUE; + *foundPtr = true; } else { @@ -403,7 +403,7 @@ ShmemInitStruct(const char *name, Size size, bool *foundPtr) Assert(shmemseghdr->index == NULL); structPtr = ShmemAlloc(size); shmemseghdr->index = structPtr; - *foundPtr = FALSE; + *foundPtr = false; } LWLockRelease(ShmemIndexLock); return structPtr; diff --git a/src/backend/storage/ipc/shmqueue.c b/src/backend/storage/ipc/shmqueue.c index 1026e67b94..da67495b03 100644 --- a/src/backend/storage/ipc/shmqueue.c +++ b/src/backend/storage/ipc/shmqueue.c @@ -40,7 +40,7 @@ SHMQueueInit(SHM_QUEUE *queue) } /* - * SHMQueueIsDetached -- TRUE if element is not currently + * SHMQueueIsDetached -- true if element is not currently * in a queue. */ bool @@ -174,7 +174,7 @@ SHMQueuePrev(const SHM_QUEUE *queue, const SHM_QUEUE *curElem, Size linkOffset) } /* - * SHMQueueEmpty -- TRUE if queue head is only element, FALSE otherwise + * SHMQueueEmpty -- true if queue head is only element, false otherwise */ bool SHMQueueEmpty(const SHM_QUEUE *queue) @@ -184,7 +184,7 @@ SHMQueueEmpty(const SHM_QUEUE *queue) if (queue->prev == queue) { Assert(queue->next == queue); - return TRUE; + return true; } - return FALSE; + return false; } diff --git a/src/backend/storage/lmgr/lock.c b/src/backend/storage/lmgr/lock.c index 2b26173924..5833086c62 100644 --- a/src/backend/storage/lmgr/lock.c +++ b/src/backend/storage/lmgr/lock.c @@ -768,7 +768,7 @@ LockAcquireExtended(const LOCKTAG *locktag, locallock->nLocks = 0; locallock->numLockOwners = 0; locallock->maxLockOwners = 8; - locallock->holdsStrongLockCount = FALSE; + locallock->holdsStrongLockCount = false; locallock->lockOwners = NULL; /* in case next line fails */ locallock->lockOwners = (LOCALLOCKOWNER *) MemoryContextAlloc(TopMemoryContext, @@ -1264,7 +1264,7 @@ RemoveLocalLock(LOCALLOCK *locallock) SpinLockAcquire(&FastPathStrongRelationLocks->mutex); Assert(FastPathStrongRelationLocks->count[fasthashcode] > 0); FastPathStrongRelationLocks->count[fasthashcode]--; - locallock->holdsStrongLockCount = FALSE; + locallock->holdsStrongLockCount = false; SpinLockRelease(&FastPathStrongRelationLocks->mutex); } @@ -1578,7 +1578,7 @@ static void BeginStrongLockAcquire(LOCALLOCK *locallock, uint32 fasthashcode) { Assert(StrongLockInProgress == NULL); - Assert(locallock->holdsStrongLockCount == FALSE); + Assert(locallock->holdsStrongLockCount == false); /* * Adding to a memory location is not atomic, so we take a spinlock to @@ -1591,7 +1591,7 @@ BeginStrongLockAcquire(LOCALLOCK *locallock, uint32 fasthashcode) SpinLockAcquire(&FastPathStrongRelationLocks->mutex); FastPathStrongRelationLocks->count[fasthashcode]++; - locallock->holdsStrongLockCount = TRUE; + locallock->holdsStrongLockCount = true; StrongLockInProgress = locallock; SpinLockRelease(&FastPathStrongRelationLocks->mutex); } @@ -1620,11 +1620,11 @@ AbortStrongLockAcquire(void) return; fasthashcode = FastPathStrongLockHashPartition(locallock->hashcode); - Assert(locallock->holdsStrongLockCount == TRUE); + Assert(locallock->holdsStrongLockCount == true); SpinLockAcquire(&FastPathStrongRelationLocks->mutex); Assert(FastPathStrongRelationLocks->count[fasthashcode] > 0); FastPathStrongRelationLocks->count[fasthashcode]--; - locallock->holdsStrongLockCount = FALSE; + locallock->holdsStrongLockCount = false; StrongLockInProgress = NULL; SpinLockRelease(&FastPathStrongRelationLocks->mutex); } @@ -1857,7 +1857,7 @@ LockRelease(const LOCKTAG *locktag, LOCKMODE lockmode, bool sessionLock) { elog(WARNING, "you don't own a lock of type %s", lockMethodTable->lockModeNames[lockmode]); - return FALSE; + return false; } /* @@ -1896,7 +1896,7 @@ LockRelease(const LOCKTAG *locktag, LOCKMODE lockmode, bool sessionLock) /* don't release a lock belonging to another owner */ elog(WARNING, "you don't own a lock of type %s", lockMethodTable->lockModeNames[lockmode]); - return FALSE; + return false; } } @@ -1907,7 +1907,7 @@ LockRelease(const LOCKTAG *locktag, LOCKMODE lockmode, bool sessionLock) locallock->nLocks--; if (locallock->nLocks > 0) - return TRUE; + return true; /* Attempt fast release of any lock eligible for the fast path. */ if (EligibleForRelationFastPath(locktag, lockmode) && @@ -1926,7 +1926,7 @@ LockRelease(const LOCKTAG *locktag, LOCKMODE lockmode, bool sessionLock) if (released) { RemoveLocalLock(locallock); - return TRUE; + return true; } } @@ -1984,7 +1984,7 @@ LockRelease(const LOCKTAG *locktag, LOCKMODE lockmode, bool sessionLock) elog(WARNING, "you don't own a lock of type %s", lockMethodTable->lockModeNames[lockmode]); RemoveLocalLock(locallock); - return FALSE; + return false; } /* @@ -1999,7 +1999,7 @@ LockRelease(const LOCKTAG *locktag, LOCKMODE lockmode, bool sessionLock) LWLockRelease(partitionLock); RemoveLocalLock(locallock); - return TRUE; + return true; } /* @@ -3137,7 +3137,7 @@ AtPrepare_Locks(void) * entry. We must retain the count until the prepared transaction is * committed or rolled back. */ - locallock->holdsStrongLockCount = FALSE; + locallock->holdsStrongLockCount = false; /* * Create a 2PC record. diff --git a/src/backend/utils/adt/datetime.c b/src/backend/utils/adt/datetime.c index a3d7dc3697..efa37644fc 100644 --- a/src/backend/utils/adt/datetime.c +++ b/src/backend/utils/adt/datetime.c @@ -791,10 +791,10 @@ DecodeDateTime(char **field, int *ftype, int nf, int val; int dterr; int mer = HR24; - bool haveTextMonth = FALSE; - bool isjulian = FALSE; - bool is2digits = FALSE; - bool bc = FALSE; + bool haveTextMonth = false; + bool isjulian = false; + bool is2digits = false; + bool bc = false; pg_tz *namedTz = NULL; pg_tz *abbrevTz = NULL; pg_tz *valtz; @@ -840,7 +840,7 @@ DecodeDateTime(char **field, int *ftype, int nf, return DTERR_FIELD_OVERFLOW; j2date(val, &tm->tm_year, &tm->tm_mon, &tm->tm_mday); - isjulian = TRUE; + isjulian = true; /* Get the time zone from the end of the string */ dterr = DecodeTimezone(cp, tzp); @@ -1087,7 +1087,7 @@ DecodeDateTime(char **field, int *ftype, int nf, return DTERR_FIELD_OVERFLOW; tmask = DTK_DATE_M; j2date(val, &tm->tm_year, &tm->tm_mon, &tm->tm_mday); - isjulian = TRUE; + isjulian = true; /* fractional Julian Day? */ if (*cp == '.') @@ -1271,7 +1271,7 @@ DecodeDateTime(char **field, int *ftype, int nf, tm->tm_mday = tm->tm_mon; tmask = DTK_M(DAY); } - haveTextMonth = TRUE; + haveTextMonth = true; tm->tm_mon = val; break; @@ -1751,9 +1751,9 @@ DecodeTimeOnly(char **field, int *ftype, int nf, int i; int val; int dterr; - bool isjulian = FALSE; - bool is2digits = FALSE; - bool bc = FALSE; + bool isjulian = false; + bool is2digits = false; + bool bc = false; int mer = HR24; pg_tz *namedTz = NULL; pg_tz *abbrevTz = NULL; @@ -1991,7 +1991,7 @@ DecodeTimeOnly(char **field, int *ftype, int nf, return DTERR_FIELD_OVERFLOW; tmask = DTK_DATE_M; j2date(val, &tm->tm_year, &tm->tm_mon, &tm->tm_mday); - isjulian = TRUE; + isjulian = true; if (*cp == '.') { @@ -2086,7 +2086,7 @@ DecodeTimeOnly(char **field, int *ftype, int nf, else { dterr = DecodeNumber(flen, field[i], - FALSE, + false, (fmask | DTK_DATE_M), &tmask, tm, fsec, &is2digits); @@ -2362,7 +2362,7 @@ DecodeTimeOnly(char **field, int *ftype, int nf, * str: field to be parsed * fmask: bitmask for field types already seen * *tmask: receives bitmask for fields found here - * *is2digits: set to TRUE if we find 2-digit year + * *is2digits: set to true if we find 2-digit year * *tm: field values are stored into appropriate members of this struct */ static int @@ -2374,7 +2374,7 @@ DecodeDate(char *str, int fmask, int *tmask, bool *is2digits, int i, len; int dterr; - bool haveTextMonth = FALSE; + bool haveTextMonth = false; int type, val, dmask = 0; @@ -2424,7 +2424,7 @@ DecodeDate(char *str, int fmask, int *tmask, bool *is2digits, { case MONTH: tm->tm_mon = val; - haveTextMonth = TRUE; + haveTextMonth = true; break; default: @@ -2755,7 +2755,7 @@ DecodeNumber(int flen, char *str, bool haveTextMonth, int fmask, *tmask = DTK_M(DAY); /* YEAR is already set */ tm->tm_mday = tm->tm_year; tm->tm_year = val; - *is2digits = FALSE; + *is2digits = false; } else { @@ -2859,7 +2859,7 @@ DecodeNumberField(int len, char *str, int fmask, *(str + (len - 4)) = '\0'; tm->tm_year = atoi(str); if ((len - 4) == 2) - *is2digits = TRUE; + *is2digits = true; return DTK_DATE; } @@ -3095,7 +3095,7 @@ int DecodeInterval(char **field, int *ftype, int nf, int range, int *dtype, struct pg_tm *tm, fsec_t *fsec) { - bool is_before = FALSE; + bool is_before = false; char *cp; int fmask = 0, tmask, @@ -3350,7 +3350,7 @@ DecodeInterval(char **field, int *ftype, int nf, int range, break; case AGO: - is_before = TRUE; + is_before = true; type = val; break; @@ -4193,7 +4193,7 @@ AddPostgresIntPart(char *cp, int value, const char *units, * tad bizarre but it's how it worked before... */ *is_before = (value < 0); - *is_zero = FALSE; + *is_zero = false; return cp + strlen(cp); } @@ -4213,7 +4213,7 @@ AddVerboseIntPart(char *cp, int value, const char *units, else if (*is_before) value = -value; sprintf(cp, " %d %s%s", value, units, (value == 1) ? "" : "s"); - *is_zero = FALSE; + *is_zero = false; return cp + strlen(cp); } @@ -4247,8 +4247,8 @@ EncodeInterval(struct pg_tm *tm, fsec_t fsec, int style, char *str) int hour = tm->tm_hour; int min = tm->tm_min; int sec = tm->tm_sec; - bool is_before = FALSE; - bool is_zero = TRUE; + bool is_before = false; + bool is_zero = true; /* * The sign of year and month are guaranteed to match, since they are @@ -4403,7 +4403,7 @@ EncodeInterval(struct pg_tm *tm, fsec_t fsec, int style, char *str) if (sec < 0 || (sec == 0 && fsec < 0)) { if (is_zero) - is_before = TRUE; + is_before = true; else if (!is_before) *cp++ = '-'; } @@ -4412,7 +4412,7 @@ EncodeInterval(struct pg_tm *tm, fsec_t fsec, int style, char *str) cp = AppendSeconds(cp, sec, fsec, MAX_INTERVAL_PRECISION, false); sprintf(cp, " sec%s", (abs(sec) != 1 || fsec != 0) ? "s" : ""); - is_zero = FALSE; + is_zero = false; } /* identically zero? then put in a unitless zero... */ if (is_zero) diff --git a/src/backend/utils/adt/formatting.c b/src/backend/utils/adt/formatting.c index 46f45f6654..56952d29a8 100644 --- a/src/backend/utils/adt/formatting.c +++ b/src/backend/utils/adt/formatting.c @@ -718,99 +718,99 @@ typedef enum */ static const KeyWord DCH_keywords[] = { /* name, len, id, is_digit, date_mode */ - {"A.D.", 4, DCH_A_D, FALSE, FROM_CHAR_DATE_NONE}, /* A */ - {"A.M.", 4, DCH_A_M, FALSE, FROM_CHAR_DATE_NONE}, - {"AD", 2, DCH_AD, FALSE, FROM_CHAR_DATE_NONE}, - {"AM", 2, DCH_AM, FALSE, FROM_CHAR_DATE_NONE}, - {"B.C.", 4, DCH_B_C, FALSE, FROM_CHAR_DATE_NONE}, /* B */ - {"BC", 2, DCH_BC, FALSE, FROM_CHAR_DATE_NONE}, - {"CC", 2, DCH_CC, TRUE, FROM_CHAR_DATE_NONE}, /* C */ - {"DAY", 3, DCH_DAY, FALSE, FROM_CHAR_DATE_NONE}, /* D */ - {"DDD", 3, DCH_DDD, TRUE, FROM_CHAR_DATE_GREGORIAN}, - {"DD", 2, DCH_DD, TRUE, FROM_CHAR_DATE_GREGORIAN}, - {"DY", 2, DCH_DY, FALSE, FROM_CHAR_DATE_NONE}, - {"Day", 3, DCH_Day, FALSE, FROM_CHAR_DATE_NONE}, - {"Dy", 2, DCH_Dy, FALSE, FROM_CHAR_DATE_NONE}, - {"D", 1, DCH_D, TRUE, FROM_CHAR_DATE_GREGORIAN}, - {"FX", 2, DCH_FX, FALSE, FROM_CHAR_DATE_NONE}, /* F */ - {"HH24", 4, DCH_HH24, TRUE, FROM_CHAR_DATE_NONE}, /* H */ - {"HH12", 4, DCH_HH12, TRUE, FROM_CHAR_DATE_NONE}, - {"HH", 2, DCH_HH, TRUE, FROM_CHAR_DATE_NONE}, - {"IDDD", 4, DCH_IDDD, TRUE, FROM_CHAR_DATE_ISOWEEK}, /* I */ - {"ID", 2, DCH_ID, TRUE, FROM_CHAR_DATE_ISOWEEK}, - {"IW", 2, DCH_IW, TRUE, FROM_CHAR_DATE_ISOWEEK}, - {"IYYY", 4, DCH_IYYY, TRUE, FROM_CHAR_DATE_ISOWEEK}, - {"IYY", 3, DCH_IYY, TRUE, FROM_CHAR_DATE_ISOWEEK}, - {"IY", 2, DCH_IY, TRUE, FROM_CHAR_DATE_ISOWEEK}, - {"I", 1, DCH_I, TRUE, FROM_CHAR_DATE_ISOWEEK}, - {"J", 1, DCH_J, TRUE, FROM_CHAR_DATE_NONE}, /* J */ - {"MI", 2, DCH_MI, TRUE, FROM_CHAR_DATE_NONE}, /* M */ - {"MM", 2, DCH_MM, TRUE, FROM_CHAR_DATE_GREGORIAN}, - {"MONTH", 5, DCH_MONTH, FALSE, FROM_CHAR_DATE_GREGORIAN}, - {"MON", 3, DCH_MON, FALSE, FROM_CHAR_DATE_GREGORIAN}, - {"MS", 2, DCH_MS, TRUE, FROM_CHAR_DATE_NONE}, - {"Month", 5, DCH_Month, FALSE, FROM_CHAR_DATE_GREGORIAN}, - {"Mon", 3, DCH_Mon, FALSE, FROM_CHAR_DATE_GREGORIAN}, - {"OF", 2, DCH_OF, FALSE, FROM_CHAR_DATE_NONE}, /* O */ - {"P.M.", 4, DCH_P_M, FALSE, FROM_CHAR_DATE_NONE}, /* P */ - {"PM", 2, DCH_PM, FALSE, FROM_CHAR_DATE_NONE}, - {"Q", 1, DCH_Q, TRUE, FROM_CHAR_DATE_NONE}, /* Q */ - {"RM", 2, DCH_RM, FALSE, FROM_CHAR_DATE_GREGORIAN}, /* R */ - {"SSSS", 4, DCH_SSSS, TRUE, FROM_CHAR_DATE_NONE}, /* S */ - {"SS", 2, DCH_SS, TRUE, FROM_CHAR_DATE_NONE}, - {"TZ", 2, DCH_TZ, FALSE, FROM_CHAR_DATE_NONE}, /* T */ - {"US", 2, DCH_US, TRUE, FROM_CHAR_DATE_NONE}, /* U */ - {"WW", 2, DCH_WW, TRUE, FROM_CHAR_DATE_GREGORIAN}, /* W */ - {"W", 1, DCH_W, TRUE, FROM_CHAR_DATE_GREGORIAN}, - {"Y,YYY", 5, DCH_Y_YYY, TRUE, FROM_CHAR_DATE_GREGORIAN}, /* Y */ - {"YYYY", 4, DCH_YYYY, TRUE, FROM_CHAR_DATE_GREGORIAN}, - {"YYY", 3, DCH_YYY, TRUE, FROM_CHAR_DATE_GREGORIAN}, - {"YY", 2, DCH_YY, TRUE, FROM_CHAR_DATE_GREGORIAN}, - {"Y", 1, DCH_Y, TRUE, FROM_CHAR_DATE_GREGORIAN}, - {"a.d.", 4, DCH_a_d, FALSE, FROM_CHAR_DATE_NONE}, /* a */ - {"a.m.", 4, DCH_a_m, FALSE, FROM_CHAR_DATE_NONE}, - {"ad", 2, DCH_ad, FALSE, FROM_CHAR_DATE_NONE}, - {"am", 2, DCH_am, FALSE, FROM_CHAR_DATE_NONE}, - {"b.c.", 4, DCH_b_c, FALSE, FROM_CHAR_DATE_NONE}, /* b */ - {"bc", 2, DCH_bc, FALSE, FROM_CHAR_DATE_NONE}, - {"cc", 2, DCH_CC, TRUE, FROM_CHAR_DATE_NONE}, /* c */ - {"day", 3, DCH_day, FALSE, FROM_CHAR_DATE_NONE}, /* d */ - {"ddd", 3, DCH_DDD, TRUE, FROM_CHAR_DATE_GREGORIAN}, - {"dd", 2, DCH_DD, TRUE, FROM_CHAR_DATE_GREGORIAN}, - {"dy", 2, DCH_dy, FALSE, FROM_CHAR_DATE_NONE}, - {"d", 1, DCH_D, TRUE, FROM_CHAR_DATE_GREGORIAN}, - {"fx", 2, DCH_FX, FALSE, FROM_CHAR_DATE_NONE}, /* f */ - {"hh24", 4, DCH_HH24, TRUE, FROM_CHAR_DATE_NONE}, /* h */ - {"hh12", 4, DCH_HH12, TRUE, FROM_CHAR_DATE_NONE}, - {"hh", 2, DCH_HH, TRUE, FROM_CHAR_DATE_NONE}, - {"iddd", 4, DCH_IDDD, TRUE, FROM_CHAR_DATE_ISOWEEK}, /* i */ - {"id", 2, DCH_ID, TRUE, FROM_CHAR_DATE_ISOWEEK}, - {"iw", 2, DCH_IW, TRUE, FROM_CHAR_DATE_ISOWEEK}, - {"iyyy", 4, DCH_IYYY, TRUE, FROM_CHAR_DATE_ISOWEEK}, - {"iyy", 3, DCH_IYY, TRUE, FROM_CHAR_DATE_ISOWEEK}, - {"iy", 2, DCH_IY, TRUE, FROM_CHAR_DATE_ISOWEEK}, - {"i", 1, DCH_I, TRUE, FROM_CHAR_DATE_ISOWEEK}, - {"j", 1, DCH_J, TRUE, FROM_CHAR_DATE_NONE}, /* j */ - {"mi", 2, DCH_MI, TRUE, FROM_CHAR_DATE_NONE}, /* m */ - {"mm", 2, DCH_MM, TRUE, FROM_CHAR_DATE_GREGORIAN}, - {"month", 5, DCH_month, FALSE, FROM_CHAR_DATE_GREGORIAN}, - {"mon", 3, DCH_mon, FALSE, FROM_CHAR_DATE_GREGORIAN}, - {"ms", 2, DCH_MS, TRUE, FROM_CHAR_DATE_NONE}, - {"p.m.", 4, DCH_p_m, FALSE, FROM_CHAR_DATE_NONE}, /* p */ - {"pm", 2, DCH_pm, FALSE, FROM_CHAR_DATE_NONE}, - {"q", 1, DCH_Q, TRUE, FROM_CHAR_DATE_NONE}, /* q */ - {"rm", 2, DCH_rm, FALSE, FROM_CHAR_DATE_GREGORIAN}, /* r */ - {"ssss", 4, DCH_SSSS, TRUE, FROM_CHAR_DATE_NONE}, /* s */ - {"ss", 2, DCH_SS, TRUE, FROM_CHAR_DATE_NONE}, - {"tz", 2, DCH_tz, FALSE, FROM_CHAR_DATE_NONE}, /* t */ - {"us", 2, DCH_US, TRUE, FROM_CHAR_DATE_NONE}, /* u */ - {"ww", 2, DCH_WW, TRUE, FROM_CHAR_DATE_GREGORIAN}, /* w */ - {"w", 1, DCH_W, TRUE, FROM_CHAR_DATE_GREGORIAN}, - {"y,yyy", 5, DCH_Y_YYY, TRUE, FROM_CHAR_DATE_GREGORIAN}, /* y */ - {"yyyy", 4, DCH_YYYY, TRUE, FROM_CHAR_DATE_GREGORIAN}, - {"yyy", 3, DCH_YYY, TRUE, FROM_CHAR_DATE_GREGORIAN}, - {"yy", 2, DCH_YY, TRUE, FROM_CHAR_DATE_GREGORIAN}, - {"y", 1, DCH_Y, TRUE, FROM_CHAR_DATE_GREGORIAN}, + {"A.D.", 4, DCH_A_D, false, FROM_CHAR_DATE_NONE}, /* A */ + {"A.M.", 4, DCH_A_M, false, FROM_CHAR_DATE_NONE}, + {"AD", 2, DCH_AD, false, FROM_CHAR_DATE_NONE}, + {"AM", 2, DCH_AM, false, FROM_CHAR_DATE_NONE}, + {"B.C.", 4, DCH_B_C, false, FROM_CHAR_DATE_NONE}, /* B */ + {"BC", 2, DCH_BC, false, FROM_CHAR_DATE_NONE}, + {"CC", 2, DCH_CC, true, FROM_CHAR_DATE_NONE}, /* C */ + {"DAY", 3, DCH_DAY, false, FROM_CHAR_DATE_NONE}, /* D */ + {"DDD", 3, DCH_DDD, true, FROM_CHAR_DATE_GREGORIAN}, + {"DD", 2, DCH_DD, true, FROM_CHAR_DATE_GREGORIAN}, + {"DY", 2, DCH_DY, false, FROM_CHAR_DATE_NONE}, + {"Day", 3, DCH_Day, false, FROM_CHAR_DATE_NONE}, + {"Dy", 2, DCH_Dy, false, FROM_CHAR_DATE_NONE}, + {"D", 1, DCH_D, true, FROM_CHAR_DATE_GREGORIAN}, + {"FX", 2, DCH_FX, false, FROM_CHAR_DATE_NONE}, /* F */ + {"HH24", 4, DCH_HH24, true, FROM_CHAR_DATE_NONE}, /* H */ + {"HH12", 4, DCH_HH12, true, FROM_CHAR_DATE_NONE}, + {"HH", 2, DCH_HH, true, FROM_CHAR_DATE_NONE}, + {"IDDD", 4, DCH_IDDD, true, FROM_CHAR_DATE_ISOWEEK}, /* I */ + {"ID", 2, DCH_ID, true, FROM_CHAR_DATE_ISOWEEK}, + {"IW", 2, DCH_IW, true, FROM_CHAR_DATE_ISOWEEK}, + {"IYYY", 4, DCH_IYYY, true, FROM_CHAR_DATE_ISOWEEK}, + {"IYY", 3, DCH_IYY, true, FROM_CHAR_DATE_ISOWEEK}, + {"IY", 2, DCH_IY, true, FROM_CHAR_DATE_ISOWEEK}, + {"I", 1, DCH_I, true, FROM_CHAR_DATE_ISOWEEK}, + {"J", 1, DCH_J, true, FROM_CHAR_DATE_NONE}, /* J */ + {"MI", 2, DCH_MI, true, FROM_CHAR_DATE_NONE}, /* M */ + {"MM", 2, DCH_MM, true, FROM_CHAR_DATE_GREGORIAN}, + {"MONTH", 5, DCH_MONTH, false, FROM_CHAR_DATE_GREGORIAN}, + {"MON", 3, DCH_MON, false, FROM_CHAR_DATE_GREGORIAN}, + {"MS", 2, DCH_MS, true, FROM_CHAR_DATE_NONE}, + {"Month", 5, DCH_Month, false, FROM_CHAR_DATE_GREGORIAN}, + {"Mon", 3, DCH_Mon, false, FROM_CHAR_DATE_GREGORIAN}, + {"OF", 2, DCH_OF, false, FROM_CHAR_DATE_NONE}, /* O */ + {"P.M.", 4, DCH_P_M, false, FROM_CHAR_DATE_NONE}, /* P */ + {"PM", 2, DCH_PM, false, FROM_CHAR_DATE_NONE}, + {"Q", 1, DCH_Q, true, FROM_CHAR_DATE_NONE}, /* Q */ + {"RM", 2, DCH_RM, false, FROM_CHAR_DATE_GREGORIAN}, /* R */ + {"SSSS", 4, DCH_SSSS, true, FROM_CHAR_DATE_NONE}, /* S */ + {"SS", 2, DCH_SS, true, FROM_CHAR_DATE_NONE}, + {"TZ", 2, DCH_TZ, false, FROM_CHAR_DATE_NONE}, /* T */ + {"US", 2, DCH_US, true, FROM_CHAR_DATE_NONE}, /* U */ + {"WW", 2, DCH_WW, true, FROM_CHAR_DATE_GREGORIAN}, /* W */ + {"W", 1, DCH_W, true, FROM_CHAR_DATE_GREGORIAN}, + {"Y,YYY", 5, DCH_Y_YYY, true, FROM_CHAR_DATE_GREGORIAN}, /* Y */ + {"YYYY", 4, DCH_YYYY, true, FROM_CHAR_DATE_GREGORIAN}, + {"YYY", 3, DCH_YYY, true, FROM_CHAR_DATE_GREGORIAN}, + {"YY", 2, DCH_YY, true, FROM_CHAR_DATE_GREGORIAN}, + {"Y", 1, DCH_Y, true, FROM_CHAR_DATE_GREGORIAN}, + {"a.d.", 4, DCH_a_d, false, FROM_CHAR_DATE_NONE}, /* a */ + {"a.m.", 4, DCH_a_m, false, FROM_CHAR_DATE_NONE}, + {"ad", 2, DCH_ad, false, FROM_CHAR_DATE_NONE}, + {"am", 2, DCH_am, false, FROM_CHAR_DATE_NONE}, + {"b.c.", 4, DCH_b_c, false, FROM_CHAR_DATE_NONE}, /* b */ + {"bc", 2, DCH_bc, false, FROM_CHAR_DATE_NONE}, + {"cc", 2, DCH_CC, true, FROM_CHAR_DATE_NONE}, /* c */ + {"day", 3, DCH_day, false, FROM_CHAR_DATE_NONE}, /* d */ + {"ddd", 3, DCH_DDD, true, FROM_CHAR_DATE_GREGORIAN}, + {"dd", 2, DCH_DD, true, FROM_CHAR_DATE_GREGORIAN}, + {"dy", 2, DCH_dy, false, FROM_CHAR_DATE_NONE}, + {"d", 1, DCH_D, true, FROM_CHAR_DATE_GREGORIAN}, + {"fx", 2, DCH_FX, false, FROM_CHAR_DATE_NONE}, /* f */ + {"hh24", 4, DCH_HH24, true, FROM_CHAR_DATE_NONE}, /* h */ + {"hh12", 4, DCH_HH12, true, FROM_CHAR_DATE_NONE}, + {"hh", 2, DCH_HH, true, FROM_CHAR_DATE_NONE}, + {"iddd", 4, DCH_IDDD, true, FROM_CHAR_DATE_ISOWEEK}, /* i */ + {"id", 2, DCH_ID, true, FROM_CHAR_DATE_ISOWEEK}, + {"iw", 2, DCH_IW, true, FROM_CHAR_DATE_ISOWEEK}, + {"iyyy", 4, DCH_IYYY, true, FROM_CHAR_DATE_ISOWEEK}, + {"iyy", 3, DCH_IYY, true, FROM_CHAR_DATE_ISOWEEK}, + {"iy", 2, DCH_IY, true, FROM_CHAR_DATE_ISOWEEK}, + {"i", 1, DCH_I, true, FROM_CHAR_DATE_ISOWEEK}, + {"j", 1, DCH_J, true, FROM_CHAR_DATE_NONE}, /* j */ + {"mi", 2, DCH_MI, true, FROM_CHAR_DATE_NONE}, /* m */ + {"mm", 2, DCH_MM, true, FROM_CHAR_DATE_GREGORIAN}, + {"month", 5, DCH_month, false, FROM_CHAR_DATE_GREGORIAN}, + {"mon", 3, DCH_mon, false, FROM_CHAR_DATE_GREGORIAN}, + {"ms", 2, DCH_MS, true, FROM_CHAR_DATE_NONE}, + {"p.m.", 4, DCH_p_m, false, FROM_CHAR_DATE_NONE}, /* p */ + {"pm", 2, DCH_pm, false, FROM_CHAR_DATE_NONE}, + {"q", 1, DCH_Q, true, FROM_CHAR_DATE_NONE}, /* q */ + {"rm", 2, DCH_rm, false, FROM_CHAR_DATE_GREGORIAN}, /* r */ + {"ssss", 4, DCH_SSSS, true, FROM_CHAR_DATE_NONE}, /* s */ + {"ss", 2, DCH_SS, true, FROM_CHAR_DATE_NONE}, + {"tz", 2, DCH_tz, false, FROM_CHAR_DATE_NONE}, /* t */ + {"us", 2, DCH_US, true, FROM_CHAR_DATE_NONE}, /* u */ + {"ww", 2, DCH_WW, true, FROM_CHAR_DATE_GREGORIAN}, /* w */ + {"w", 1, DCH_W, true, FROM_CHAR_DATE_GREGORIAN}, + {"y,yyy", 5, DCH_Y_YYY, true, FROM_CHAR_DATE_GREGORIAN}, /* y */ + {"yyyy", 4, DCH_YYYY, true, FROM_CHAR_DATE_GREGORIAN}, + {"yyy", 3, DCH_YYY, true, FROM_CHAR_DATE_GREGORIAN}, + {"yy", 2, DCH_YY, true, FROM_CHAR_DATE_GREGORIAN}, + {"y", 1, DCH_Y, true, FROM_CHAR_DATE_GREGORIAN}, /* last */ {NULL, 0, 0, 0, 0} @@ -1102,7 +1102,7 @@ NUMDesc_prepare(NUMDesc *num, FormatNode *n) case NUM_D: num->flag |= NUM_F_LDECIMAL; - num->need_locale = TRUE; + num->need_locale = true; /* FALLTHROUGH */ case NUM_DEC: if (IS_DECIMAL(num)) @@ -1133,13 +1133,13 @@ NUMDesc_prepare(NUMDesc *num, FormatNode *n) { num->lsign = NUM_LSIGN_PRE; num->pre_lsign_num = num->pre; - num->need_locale = TRUE; + num->need_locale = true; num->flag |= NUM_F_LSIGN; } else if (num->lsign == NUM_LSIGN_NONE) { num->lsign = NUM_LSIGN_POST; - num->need_locale = TRUE; + num->need_locale = true; num->flag |= NUM_F_LSIGN; } break; @@ -1188,7 +1188,7 @@ NUMDesc_prepare(NUMDesc *num, FormatNode *n) case NUM_L: case NUM_G: - num->need_locale = TRUE; + num->need_locale = true; break; case NUM_V: @@ -2072,17 +2072,17 @@ dump_index(const KeyWord *k, const int *index) #endif /* DEBUG */ /* ---------- - * Return TRUE if next format picture is not digit value + * Return true if next format picture is not digit value * ---------- */ static bool is_next_separator(FormatNode *n) { if (n->type == NODE_TYPE_END) - return FALSE; + return false; if (n->type == NODE_TYPE_ACTION && S_THth(n->suffix)) - return TRUE; + return true; /* * Next node @@ -2091,19 +2091,19 @@ is_next_separator(FormatNode *n) /* end of format string is treated like a non-digit separator */ if (n->type == NODE_TYPE_END) - return TRUE; + return true; if (n->type == NODE_TYPE_ACTION) { if (n->key->is_digit) - return FALSE; + return false; - return TRUE; + return true; } else if (isdigit((unsigned char) n->character)) - return FALSE; + return false; - return TRUE; /* some non-digit input (separator) */ + return true; /* some non-digit input (separator) */ } @@ -3397,7 +3397,7 @@ datetime_to_char_body(TmToChar *tmtc, text *fmt, bool is_interval, Oid collid) * Allocate new memory if format picture is bigger than static cache * and do not use cache (call parser always) */ - incache = FALSE; + incache = false; format = (FormatNode *) palloc((fmt_len + 1) * sizeof(FormatNode)); @@ -3411,7 +3411,7 @@ datetime_to_char_body(TmToChar *tmtc, text *fmt, bool is_interval, Oid collid) */ DCHCacheEntry *ent = DCH_cache_fetch(fmt_str); - incache = TRUE; + incache = true; format = ent->format; } @@ -3642,7 +3642,7 @@ do_to_timestamp(text *date_txt, text *fmt, * Allocate new memory if format picture is bigger than static * cache and do not use cache (call parser always) */ - incache = FALSE; + incache = false; format = (FormatNode *) palloc((fmt_len + 1) * sizeof(FormatNode)); @@ -3656,7 +3656,7 @@ do_to_timestamp(text *date_txt, text *fmt, */ DCHCacheEntry *ent = DCH_cache_fetch(fmt_str); - incache = TRUE; + incache = true; format = ent->format; } @@ -4245,7 +4245,7 @@ get_last_relevant_decnum(char *num) static void NUM_numpart_from_char(NUMProc *Np, int id, int input_len) { - bool isread = FALSE; + bool isread = false; #ifdef DEBUG_TO_FROM_CHAR elog(DEBUG_elog_output, " --- scan start --- id=%s", @@ -4346,13 +4346,13 @@ NUM_numpart_from_char(NUMProc *Np, int id, int input_len) else Np->read_pre++; - isread = TRUE; + isread = true; #ifdef DEBUG_TO_FROM_CHAR elog(DEBUG_elog_output, "Read digit (%c)", *Np->inout_p); #endif } - else if (IS_DECIMAL(Np->Num) && Np->read_dec == FALSE) + else if (IS_DECIMAL(Np->Num) && Np->read_dec == false) { /* * We need not test IS_LDECIMAL(Np->Num) explicitly here, because @@ -4370,8 +4370,8 @@ NUM_numpart_from_char(NUMProc *Np, int id, int input_len) Np->inout_p += x - 1; *Np->number_p = '.'; Np->number_p++; - Np->read_dec = TRUE; - isread = TRUE; + Np->read_dec = true; + isread = true; } } @@ -4429,11 +4429,11 @@ NUM_numpart_from_char(NUMProc *Np, int id, int input_len) * * FM9.999999MI -> 5.01- * - * if (.... && IS_LSIGN(Np->Num)==FALSE) prevents read wrong formats + * if (.... && IS_LSIGN(Np->Num)==false) prevents read wrong formats * like to_number('1 -', '9S') where sign is not anchored to last * number. */ - else if (isread == FALSE && IS_LSIGN(Np->Num) == FALSE && + else if (isread == false && IS_LSIGN(Np->Num) == false && (IS_PLUS(Np->Num) || IS_MINUS(Np->Num))) { #ifdef DEBUG_TO_FROM_CHAR @@ -4451,7 +4451,7 @@ NUM_numpart_from_char(NUMProc *Np, int id, int input_len) } #define IS_PREDEC_SPACE(_n) \ - (IS_ZERO((_n)->Num)==FALSE && \ + (IS_ZERO((_n)->Num)==false && \ (_n)->number == (_n)->number_p && \ *(_n)->number == '0' && \ (_n)->Num->post != 0) @@ -4483,15 +4483,15 @@ NUM_numpart_to_char(NUMProc *Np, int id) Np->number_p, Np->inout); #endif - Np->num_in = FALSE; + Np->num_in = false; /* * Write sign if real number will write to output Note: IS_PREDEC_SPACE() * handle "9.9" --> " .1" */ - if (Np->sign_wrote == FALSE && + if (Np->sign_wrote == false && (Np->num_curr >= Np->out_pre_spaces || (IS_ZERO(Np->Num) && Np->Num->zero_start == Np->num_curr)) && - (IS_PREDEC_SPACE(Np) == FALSE || (Np->last_relevant && *Np->last_relevant == '.'))) + (IS_PREDEC_SPACE(Np) == false || (Np->last_relevant && *Np->last_relevant == '.'))) { if (IS_LSIGN(Np->Num)) { @@ -4502,14 +4502,14 @@ NUM_numpart_to_char(NUMProc *Np, int id) else strcpy(Np->inout_p, Np->L_positive_sign); Np->inout_p += strlen(Np->inout_p); - Np->sign_wrote = TRUE; + Np->sign_wrote = true; } } else if (IS_BRACKET(Np->Num)) { *Np->inout_p = Np->sign == '+' ? ' ' : '<'; ++Np->inout_p; - Np->sign_wrote = TRUE; + Np->sign_wrote = true; } else if (Np->sign == '+') { @@ -4518,13 +4518,13 @@ NUM_numpart_to_char(NUMProc *Np, int id) *Np->inout_p = ' '; /* Write + */ ++Np->inout_p; } - Np->sign_wrote = TRUE; + Np->sign_wrote = true; } else if (Np->sign == '-') { /* Write - */ *Np->inout_p = '-'; ++Np->inout_p; - Np->sign_wrote = TRUE; + Np->sign_wrote = true; } } @@ -4555,7 +4555,7 @@ NUM_numpart_to_char(NUMProc *Np, int id) */ *Np->inout_p = '0'; /* Write '0' */ ++Np->inout_p; - Np->num_in = TRUE; + Np->num_in = true; } else { @@ -4613,7 +4613,7 @@ NUM_numpart_to_char(NUMProc *Np, int id) { *Np->inout_p = *Np->number_p; /* Write DIGIT */ ++Np->inout_p; - Np->num_in = TRUE; + Np->num_in = true; } } /* do no exceed string length */ @@ -4628,7 +4628,7 @@ NUM_numpart_to_char(NUMProc *Np, int id) if (Np->num_curr + 1 == end) { - if (Np->sign_wrote == TRUE && IS_BRACKET(Np->Num)) + if (Np->sign_wrote == true && IS_BRACKET(Np->Num)) { *Np->inout_p = Np->sign == '+' ? ' ' : '>'; ++Np->inout_p; @@ -4665,7 +4665,7 @@ NUM_processor(FormatNode *node, NUMDesc *Num, char *inout, Np->last_relevant = NULL; Np->read_post = 0; Np->read_pre = 0; - Np->read_dec = FALSE; + Np->read_dec = false; if (Np->Num->zero_start) --Np->Num->zero_start; @@ -4712,10 +4712,10 @@ NUM_processor(FormatNode *node, NUMDesc *Num, char *inout, /* MI/PL/SG - write sign itself and not in number */ if (IS_PLUS(Np->Num) || IS_MINUS(Np->Num)) { - if (IS_PLUS(Np->Num) && IS_MINUS(Np->Num) == FALSE) - Np->sign_wrote = FALSE; /* need sign */ + if (IS_PLUS(Np->Num) && IS_MINUS(Np->Num) == false) + Np->sign_wrote = false; /* need sign */ else - Np->sign_wrote = TRUE; /* needn't sign */ + Np->sign_wrote = true; /* needn't sign */ } else { @@ -4729,17 +4729,17 @@ NUM_processor(FormatNode *node, NUMDesc *Num, char *inout, else if (Np->sign != '+' && IS_PLUS(Np->Num)) Np->Num->flag &= ~NUM_F_PLUS; - if (Np->sign == '+' && IS_FILLMODE(Np->Num) && IS_LSIGN(Np->Num) == FALSE) - Np->sign_wrote = TRUE; /* needn't sign */ + if (Np->sign == '+' && IS_FILLMODE(Np->Num) && IS_LSIGN(Np->Num) == false) + Np->sign_wrote = true; /* needn't sign */ else - Np->sign_wrote = FALSE; /* need sign */ + Np->sign_wrote = false; /* need sign */ if (Np->Num->lsign == NUM_LSIGN_PRE && Np->Num->pre == Np->Num->pre_lsign_num) Np->Num->lsign = NUM_LSIGN_POST; } } else - Np->sign = FALSE; + Np->sign = false; /* * Count @@ -4768,7 +4768,7 @@ NUM_processor(FormatNode *node, NUMDesc *Num, char *inout, } } - if (Np->sign_wrote == FALSE && Np->out_pre_spaces == 0) + if (Np->sign_wrote == false && Np->out_pre_spaces == 0) ++Np->num_count; } else diff --git a/src/backend/utils/adt/geo_ops.c b/src/backend/utils/adt/geo_ops.c index 0348855b11..70f3d319cc 100644 --- a/src/backend/utils/adt/geo_ops.c +++ b/src/backend/utils/adt/geo_ops.c @@ -1530,7 +1530,7 @@ path_close(PG_FUNCTION_ARGS) { PATH *path = PG_GETARG_PATH_P_COPY(0); - path->closed = TRUE; + path->closed = true; PG_RETURN_PATH_P(path); } @@ -1540,7 +1540,7 @@ path_open(PG_FUNCTION_ARGS) { PATH *path = PG_GETARG_PATH_P_COPY(0); - path->closed = FALSE; + path->closed = false; PG_RETURN_PATH_P(path); } @@ -4499,7 +4499,7 @@ poly_path(PG_FUNCTION_ARGS) SET_VARSIZE(path, size); path->npts = poly->npts; - path->closed = TRUE; + path->closed = true; /* prevent instability in unused pad bytes */ path->dummy = 0; @@ -5401,7 +5401,7 @@ plist_same(int npts, Point *p1, Point *p2) printf("plist_same- ii = %d/%d after forward match\n", ii, npts); #endif if (ii == npts) - return TRUE; + return true; /* match not found forwards? then look backwards */ for (ii = 1, j = i - 1; ii < npts; ii++, j--) @@ -5421,11 +5421,11 @@ plist_same(int npts, Point *p1, Point *p2) printf("plist_same- ii = %d/%d after reverse match\n", ii, npts); #endif if (ii == npts) - return TRUE; + return true; } } - return FALSE; + return false; } diff --git a/src/backend/utils/adt/network_gist.c b/src/backend/utils/adt/network_gist.c index a0097dae9c..a1607e8793 100644 --- a/src/backend/utils/adt/network_gist.c +++ b/src/backend/utils/adt/network_gist.c @@ -561,13 +561,13 @@ inet_gist_compress(PG_FUNCTION_ARGS) gistentryinit(*retval, PointerGetDatum(r), entry->rel, entry->page, - entry->offset, FALSE); + entry->offset, false); } else { gistentryinit(*retval, (Datum) 0, entry->rel, entry->page, - entry->offset, FALSE); + entry->offset, false); } } else @@ -610,7 +610,7 @@ inet_gist_fetch(PG_FUNCTION_ARGS) retval = palloc(sizeof(GISTENTRY)); gistentryinit(*retval, InetPGetDatum(dst), entry->rel, entry->page, - entry->offset, FALSE); + entry->offset, false); PG_RETURN_POINTER(retval); } diff --git a/src/backend/utils/adt/numeric.c b/src/backend/utils/adt/numeric.c index 3e5614ece3..5c95320343 100644 --- a/src/backend/utils/adt/numeric.c +++ b/src/backend/utils/adt/numeric.c @@ -5447,7 +5447,7 @@ zero_var(NumericVar *var) static const char * set_var_from_str(const char *str, const char *cp, NumericVar *dest) { - bool have_dp = FALSE; + bool have_dp = false; int i; unsigned char *decdigits; int sign = NUMERIC_POS; @@ -5478,7 +5478,7 @@ set_var_from_str(const char *str, const char *cp, NumericVar *dest) if (*cp == '.') { - have_dp = TRUE; + have_dp = true; cp++; } @@ -5511,7 +5511,7 @@ set_var_from_str(const char *str, const char *cp, NumericVar *dest) (errcode(ERRCODE_INVALID_TEXT_REPRESENTATION), errmsg("invalid input syntax for type %s: \"%s\"", "numeric", str))); - have_dp = TRUE; + have_dp = true; cp++; } else @@ -6080,7 +6080,7 @@ apply_typmod(NumericVar *var, int32 typmod) /* * Convert numeric to int8, rounding if needed. * - * If overflow, return FALSE (no error is raised). Return TRUE if okay. + * If overflow, return false (no error is raised). Return true if okay. */ static bool numericvar_to_int64(NumericVar *var, int64 *result) @@ -6199,7 +6199,7 @@ int64_to_numericvar(int64 val, NumericVar *var) /* * Convert numeric to int128, rounding if needed. * - * If overflow, return FALSE (no error is raised). Return TRUE if okay. + * If overflow, return false (no error is raised). Return true if okay. */ static bool numericvar_to_int128(NumericVar *var, int128 *result) diff --git a/src/backend/utils/adt/tsginidx.c b/src/backend/utils/adt/tsginidx.c index 83a939dfd5..aba456ed88 100644 --- a/src/backend/utils/adt/tsginidx.c +++ b/src/backend/utils/adt/tsginidx.c @@ -295,7 +295,7 @@ gin_tsquery_consistent(PG_FUNCTION_ARGS) /* int32 nkeys = PG_GETARG_INT32(3); */ Pointer *extra_data = (Pointer *) PG_GETARG_POINTER(4); bool *recheck = (bool *) PG_GETARG_POINTER(5); - bool res = FALSE; + bool res = false; /* Initially assume query doesn't require recheck */ *recheck = false; diff --git a/src/backend/utils/adt/tsgistidx.c b/src/backend/utils/adt/tsgistidx.c index 7ce2699b5c..196a9381bc 100644 --- a/src/backend/utils/adt/tsgistidx.c +++ b/src/backend/utils/adt/tsgistidx.c @@ -240,7 +240,7 @@ gtsvector_compress(PG_FUNCTION_ARGS) retval = (GISTENTRY *) palloc(sizeof(GISTENTRY)); gistentryinit(*retval, PointerGetDatum(res), entry->rel, entry->page, - entry->offset, FALSE); + entry->offset, false); } else if (ISSIGNKEY(DatumGetPointer(entry->key)) && !ISALLTRUE(DatumGetPointer(entry->key))) @@ -264,7 +264,7 @@ gtsvector_compress(PG_FUNCTION_ARGS) retval = (GISTENTRY *) palloc(sizeof(GISTENTRY)); gistentryinit(*retval, PointerGetDatum(res), entry->rel, entry->page, - entry->offset, FALSE); + entry->offset, false); } PG_RETURN_POINTER(retval); } @@ -281,7 +281,7 @@ gtsvector_decompress(PG_FUNCTION_ARGS) gistentryinit(*retval, PointerGetDatum(key), entry->rel, entry->page, - entry->offset, FALSE); + entry->offset, false); PG_RETURN_POINTER(retval); } diff --git a/src/backend/utils/adt/tsquery_gist.c b/src/backend/utils/adt/tsquery_gist.c index 85518dc7d9..0f31c4d28f 100644 --- a/src/backend/utils/adt/tsquery_gist.c +++ b/src/backend/utils/adt/tsquery_gist.c @@ -37,7 +37,7 @@ gtsquery_compress(PG_FUNCTION_ARGS) gistentryinit(*retval, TSQuerySignGetDatum(sign), entry->rel, entry->page, - entry->offset, FALSE); + entry->offset, false); } PG_RETURN_POINTER(retval); @@ -80,7 +80,7 @@ gtsquery_consistent(PG_FUNCTION_ARGS) retval = (key & sq) != 0; break; default: - retval = FALSE; + retval = false; } PG_RETURN_BOOL(retval); } diff --git a/src/backend/utils/misc/guc.c b/src/backend/utils/misc/guc.c index 246fea8693..8e117eb261 100644 --- a/src/backend/utils/misc/guc.c +++ b/src/backend/utils/misc/guc.c @@ -3952,9 +3952,9 @@ static int num_guc_variables; static int size_guc_variables; -static bool guc_dirty; /* TRUE if need to do commit/abort work */ +static bool guc_dirty; /* true if need to do commit/abort work */ -static bool reporting_enabled; /* TRUE to enable GUC_REPORT */ +static bool reporting_enabled; /* true to enable GUC_REPORT */ static int GUCNestLevel = 0; /* 1 when in main transaction */ @@ -4376,7 +4376,7 @@ add_placeholder_variable(const char *name, int elevel) /* * Look up option NAME. If it exists, return a pointer to its record, - * else return NULL. If create_placeholders is TRUE, we'll create a + * else return NULL. If create_placeholders is true, we'll create a * placeholder record for a valid-looking custom variable name. */ static struct config_generic * @@ -5645,7 +5645,7 @@ config_enum_lookup_by_value(struct config_enum *record, int val) * Lookup the value for an enum option with the selected name * (case-insensitive). * If the enum option is found, sets the retval value and returns - * true. If it's not found, return FALSE and retval is set to 0. + * true. If it's not found, return false and retval is set to 0. */ bool config_enum_lookup_by_name(struct config_enum *record, const char *value, @@ -5658,12 +5658,12 @@ config_enum_lookup_by_name(struct config_enum *record, const char *value, if (pg_strcasecmp(value, entry->name) == 0) { *retval = entry->val; - return TRUE; + return true; } } *retval = 0; - return FALSE; + return false; } @@ -8370,7 +8370,7 @@ show_config_by_name(PG_FUNCTION_ARGS) /* * show_config_by_name_missing_ok - equiv to SHOW X command but implemented as * a function. If X does not exist, suppress the error and just return NULL - * if missing_ok is TRUE. + * if missing_ok is true. */ Datum show_config_by_name_missing_ok(PG_FUNCTION_ARGS) @@ -9699,7 +9699,7 @@ GUCArrayReset(ArrayType *array) * or NULL for the Delete/Reset cases. If skipIfNoPermissions is true, it's * not an error to have no permissions to set the option. * - * Returns TRUE if OK, FALSE if skipIfNoPermissions is true and user does not + * Returns true if OK, false if skipIfNoPermissions is true and user does not * have permission to change this option (all other error cases result in an * error being thrown). */ @@ -9725,7 +9725,7 @@ validate_option_array_item(const char *name, const char *value, * define_custom_variable assumes we checked that. * * name is not known and can't be created as a placeholder. Throw error, - * unless skipIfNoPermissions is true, in which case return FALSE. + * unless skipIfNoPermissions is true, in which case return false. */ gconf = find_option(name, true, WARNING); if (!gconf) diff --git a/src/interfaces/ecpg/preproc/pgc.l b/src/interfaces/ecpg/preproc/pgc.l index 3598a200d0..06b0ca1a2e 100644 --- a/src/interfaces/ecpg/preproc/pgc.l +++ b/src/interfaces/ecpg/preproc/pgc.l @@ -987,12 +987,12 @@ cppline {space}*#([^i][A-Za-z]*|{if}|{ifdef}|{ifndef}|{import})((\/\*[^*/]*\*+ return (S_ANYTHING); } } -<C,xskip>{exec_sql}{ifdef}{space}* { ifcond = TRUE; BEGIN(xcond); } +<C,xskip>{exec_sql}{ifdef}{space}* { ifcond = true; BEGIN(xcond); } <C,xskip>{informix_special}{ifdef}{space}* { /* are we simulating Informix? */ if (INFORMIX_MODE) { - ifcond = TRUE; + ifcond = true; BEGIN(xcond); } else @@ -1001,12 +1001,12 @@ cppline {space}*#([^i][A-Za-z]*|{if}|{ifdef}|{ifndef}|{import})((\/\*[^*/]*\*+ return (S_ANYTHING); } } -<C,xskip>{exec_sql}{ifndef}{space}* { ifcond = FALSE; BEGIN(xcond); } +<C,xskip>{exec_sql}{ifndef}{space}* { ifcond = false; BEGIN(xcond); } <C,xskip>{informix_special}{ifndef}{space}* { /* are we simulating Informix? */ if (INFORMIX_MODE) { - ifcond = FALSE; + ifcond = false; BEGIN(xcond); } else @@ -1024,7 +1024,7 @@ cppline {space}*#([^i][A-Za-z]*|{if}|{ifdef}|{ifndef}|{import})((\/\*[^*/]*\*+ else preproc_tos--; - ifcond = TRUE; BEGIN(xcond); + ifcond = true; BEGIN(xcond); } <C,xskip>{informix_special}{elif}{space}* { /* are we simulating Informix? */ @@ -1037,7 +1037,7 @@ cppline {space}*#([^i][A-Za-z]*|{if}|{ifdef}|{ifndef}|{import})((\/\*[^*/]*\*+ else preproc_tos--; - ifcond = TRUE; + ifcond = true; BEGIN(xcond); } else @@ -1052,7 +1052,7 @@ cppline {space}*#([^i][A-Za-z]*|{if}|{ifdef}|{ifndef}|{import})((\/\*[^*/]*\*+ mmfatal(PARSE_ERROR, "more than one EXEC SQL ELSE"); else { - stacked_if_value[preproc_tos].else_branch = TRUE; + stacked_if_value[preproc_tos].else_branch = true; stacked_if_value[preproc_tos].condition = (stacked_if_value[preproc_tos-1].condition && !stacked_if_value[preproc_tos].condition); @@ -1071,7 +1071,7 @@ cppline {space}*#([^i][A-Za-z]*|{if}|{ifdef}|{ifndef}|{import})((\/\*[^*/]*\*+ mmfatal(PARSE_ERROR, "more than one EXEC SQL ELSE"); else { - stacked_if_value[preproc_tos].else_branch = TRUE; + stacked_if_value[preproc_tos].else_branch = true; stacked_if_value[preproc_tos].condition = (stacked_if_value[preproc_tos-1].condition && !stacked_if_value[preproc_tos].condition); @@ -1145,7 +1145,7 @@ cppline {space}*#([^i][A-Za-z]*|{if}|{ifdef}|{ifndef}|{import})((\/\*[^*/]*\*+ defptr = defptr->next); preproc_tos++; - stacked_if_value[preproc_tos].else_branch = FALSE; + stacked_if_value[preproc_tos].else_branch = false; stacked_if_value[preproc_tos].condition = (defptr ? ifcond : !ifcond) && stacked_if_value[preproc_tos-1].condition; } @@ -1259,9 +1259,9 @@ lex_init(void) preproc_tos = 0; yylineno = 1; - ifcond = TRUE; + ifcond = true; stacked_if_value[preproc_tos].condition = ifcond; - stacked_if_value[preproc_tos].else_branch = FALSE; + stacked_if_value[preproc_tos].else_branch = false; /* initialize literal buffer to a reasonable but expansible size */ if (literalbuf == NULL) @@ -1406,7 +1406,7 @@ parse_include(void) } /* - * ecpg_isspace() --- return TRUE if flex scanner considers char whitespace + * ecpg_isspace() --- return true if flex scanner considers char whitespace */ static bool ecpg_isspace(char ch) diff --git a/src/interfaces/libpq/fe-connect.c b/src/interfaces/libpq/fe-connect.c index d0e97ecdd4..3561d4dafd 100644 --- a/src/interfaces/libpq/fe-connect.c +++ b/src/interfaces/libpq/fe-connect.c @@ -3587,7 +3587,7 @@ closePGconn(PGconn *conn) * Don't call PQsetnonblocking() because it will fail if it's unable to * flush the connection. */ - conn->nonblocking = FALSE; + conn->nonblocking = false; /* * Close the connection, reset all transient state, flush I/O buffers. @@ -3782,8 +3782,8 @@ PQfreeCancel(PGcancel *cancel) * PQcancel and PQrequestCancel: attempt to request cancellation of the * current operation. * - * The return value is TRUE if the cancel request was successfully - * dispatched, FALSE if not (in which case an error message is available). + * The return value is true if the cancel request was successfully + * dispatched, false if not (in which case an error message is available). * Note: successful dispatch is no guarantee that there will be any effect at * the backend. The application must read the operation result as usual. * @@ -3872,7 +3872,7 @@ internal_cancel(SockAddr *raddr, int be_pid, int be_key, /* All done */ closesocket(tmpsock); SOCK_ERRNO_SET(save_errno); - return TRUE; + return true; cancel_errReturn: @@ -3890,13 +3890,13 @@ internal_cancel(SockAddr *raddr, int be_pid, int be_key, if (tmpsock != PGINVALID_SOCKET) closesocket(tmpsock); SOCK_ERRNO_SET(save_errno); - return FALSE; + return false; } /* * PQcancel: request query cancel * - * Returns TRUE if able to send the cancel request, FALSE if not. + * Returns true if able to send the cancel request, false if not. * * On failure, an error message is stored in *errbuf, which must be of size * errbufsize (recommended size is 256 bytes). *errbuf is not changed on @@ -3908,7 +3908,7 @@ PQcancel(PGcancel *cancel, char *errbuf, int errbufsize) if (!cancel) { strlcpy(errbuf, "PQcancel() -- no cancel object supplied", errbufsize); - return FALSE; + return false; } return internal_cancel(&cancel->raddr, cancel->be_pid, cancel->be_key, @@ -3918,7 +3918,7 @@ PQcancel(PGcancel *cancel, char *errbuf, int errbufsize) /* * PQrequestCancel: old, not thread-safe function for requesting query cancel * - * Returns TRUE if able to send the cancel request, FALSE if not. + * Returns true if able to send the cancel request, false if not. * * On failure, the error message is saved in conn->errorMessage; this means * that this can't be used when there might be other active operations on @@ -3934,7 +3934,7 @@ PQrequestCancel(PGconn *conn) /* Check we have an open connection */ if (!conn) - return FALSE; + return false; if (conn->sock == PGINVALID_SOCKET) { @@ -3943,7 +3943,7 @@ PQrequestCancel(PGconn *conn) conn->errorMessage.maxlen); conn->errorMessage.len = strlen(conn->errorMessage.data); - return FALSE; + return false; } r = internal_cancel(&conn->raddr, conn->be_pid, conn->be_key, @@ -4772,7 +4772,7 @@ conninfo_init(PQExpBuffer errorMessage) * Returns a malloc'd PQconninfoOption array, if parsing is successful. * Otherwise, NULL is returned and an error message is left in errorMessage. * - * If use_defaults is TRUE, default values are filled in (from a service file, + * If use_defaults is true, default values are filled in (from a service file, * environment variables, etc). */ static PQconninfoOption * @@ -4995,7 +4995,7 @@ conninfo_parse(const char *conninfo, PQExpBuffer errorMessage, * If not successful, NULL is returned and an error message is * left in errorMessage. * Defaults are supplied (from a service file, environment variables, etc) - * for unspecified options, but only if use_defaults is TRUE. + * for unspecified options, but only if use_defaults is true. * * If expand_dbname is non-zero, and the value passed for the first occurrence * of "dbname" keyword is a connection string (as indicated by @@ -5166,7 +5166,7 @@ conninfo_array_parse(const char *const *keywords, const char *const *values, * * Defaults are obtained from a service file, environment variables, etc. * - * Returns TRUE if successful, otherwise FALSE; errorMessage, if supplied, + * Returns true if successful, otherwise false; errorMessage, if supplied, * is filled in upon failure. Note that failure to locate a default value * is not an error condition here --- we just leave the option's value as * NULL. @@ -5817,7 +5817,7 @@ conninfo_getval(PQconninfoOption *connOptions, * * If not successful, returns NULL and fills errorMessage accordingly. * However, if the reason of failure is an invalid keyword being passed and - * ignoreMissing is TRUE, errorMessage will be left untouched. + * ignoreMissing is true, errorMessage will be left untouched. */ static PQconninfoOption * conninfo_storeval(PQconninfoOption *connOptions, diff --git a/src/interfaces/libpq/fe-exec.c b/src/interfaces/libpq/fe-exec.c index e1e2d18e3a..351f8a7fe0 100644 --- a/src/interfaces/libpq/fe-exec.c +++ b/src/interfaces/libpq/fe-exec.c @@ -229,17 +229,17 @@ PQsetResultAttrs(PGresult *res, int numAttributes, PGresAttDesc *attDescs) /* If attrs already exist, they cannot be overwritten. */ if (!res || res->numAttributes > 0) - return FALSE; + return false; /* ignore no-op request */ if (numAttributes <= 0 || !attDescs) - return TRUE; + return true; res->attDescs = (PGresAttDesc *) PQresultAlloc(res, numAttributes * sizeof(PGresAttDesc)); if (!res->attDescs) - return FALSE; + return false; res->numAttributes = numAttributes; memcpy(res->attDescs, attDescs, numAttributes * sizeof(PGresAttDesc)); @@ -254,13 +254,13 @@ PQsetResultAttrs(PGresult *res, int numAttributes, PGresAttDesc *attDescs) res->attDescs[i].name = res->null_field; if (!res->attDescs[i].name) - return FALSE; + return false; if (res->attDescs[i].format == 0) res->binary = 0; } - return TRUE; + return true; } /* @@ -366,7 +366,7 @@ PQcopyResult(const PGresult *src, int flags) PQclear(dest); return NULL; } - dest->events[i].resultInitialized = TRUE; + dest->events[i].resultInitialized = true; } } @@ -396,7 +396,7 @@ dupEvents(PGEvent *events, int count) newEvents[i].proc = events[i].proc; newEvents[i].passThrough = events[i].passThrough; newEvents[i].data = NULL; - newEvents[i].resultInitialized = FALSE; + newEvents[i].resultInitialized = false; newEvents[i].name = strdup(events[i].name); if (!newEvents[i].name) { @@ -423,11 +423,11 @@ PQsetvalue(PGresult *res, int tup_num, int field_num, char *value, int len) PGresAttValue *attval; if (!check_field_number(res, field_num)) - return FALSE; + return false; /* Invalid tup_num, must be <= ntups */ if (tup_num < 0 || tup_num > res->ntups) - return FALSE; + return false; /* need to allocate a new tuple? */ if (tup_num == res->ntups) @@ -437,10 +437,10 @@ PQsetvalue(PGresult *res, int tup_num, int field_num, char *value, int len) tup = (PGresAttValue *) pqResultAlloc(res, res->numAttributes * sizeof(PGresAttValue), - TRUE); + true); if (!tup) - return FALSE; + return false; /* initialize each column to NULL */ for (i = 0; i < res->numAttributes; i++) @@ -451,7 +451,7 @@ PQsetvalue(PGresult *res, int tup_num, int field_num, char *value, int len) /* add it to the array */ if (!pqAddTuple(res, tup)) - return FALSE; + return false; } attval = &res->tuples[tup_num][field_num]; @@ -469,15 +469,15 @@ PQsetvalue(PGresult *res, int tup_num, int field_num, char *value, int len) } else { - attval->value = (char *) pqResultAlloc(res, len + 1, TRUE); + attval->value = (char *) pqResultAlloc(res, len + 1, true); if (!attval->value) - return FALSE; + return false; attval->len = len; memcpy(attval->value, value, len); attval->value[len] = '\0'; } - return TRUE; + return true; } /* @@ -489,7 +489,7 @@ PQsetvalue(PGresult *res, int tup_num, int field_num, char *value, int len) void * PQresultAlloc(PGresult *res, size_t nBytes) { - return pqResultAlloc(res, nBytes, TRUE); + return pqResultAlloc(res, nBytes, true); } /* @@ -601,7 +601,7 @@ pqResultAlloc(PGresult *res, size_t nBytes, bool isBinary) char * pqResultStrdup(PGresult *res, const char *str) { - char *space = (char *) pqResultAlloc(res, strlen(str) + 1, FALSE); + char *space = (char *) pqResultAlloc(res, strlen(str) + 1, false); if (space) strcpy(space, str); @@ -831,7 +831,7 @@ pqInternalNotice(const PGNoticeHooks *hooks, const char *fmt,...) * Result text is always just the primary message + newline. If we can't * allocate it, don't bother invoking the receiver. */ - res->errMsg = (char *) pqResultAlloc(res, strlen(msgBuf) + 2, FALSE); + res->errMsg = (char *) pqResultAlloc(res, strlen(msgBuf) + 2, false); if (res->errMsg) { sprintf(res->errMsg, "%s\n", msgBuf); @@ -847,7 +847,7 @@ pqInternalNotice(const PGNoticeHooks *hooks, const char *fmt,...) /* * pqAddTuple * add a row pointer to the PGresult structure, growing it if necessary - * Returns TRUE if OK, FALSE if not enough memory to add the row + * Returns true if OK, false if not enough memory to add the row */ static bool pqAddTuple(PGresult *res, PGresAttValue *tup) @@ -875,13 +875,13 @@ pqAddTuple(PGresult *res, PGresAttValue *tup) newTuples = (PGresAttValue **) realloc(res->tuples, newSize * sizeof(PGresAttValue *)); if (!newTuples) - return FALSE; /* malloc or realloc failed */ + return false; /* malloc or realloc failed */ res->tupArrSize = newSize; res->tuples = newTuples; } res->tuples[res->ntups] = tup; res->ntups++; - return TRUE; + return true; } /* @@ -896,7 +896,7 @@ pqSaveMessageField(PGresult *res, char code, const char *value) pqResultAlloc(res, offsetof(PGMessageField, contents) + strlen(value) + 1, - TRUE); + true); if (!pfield) return; /* out of memory? */ pfield->code = code; @@ -1060,7 +1060,7 @@ pqRowProcessor(PGconn *conn, const char **errmsgp) * memory for gettext() to do anything. */ tup = (PGresAttValue *) - pqResultAlloc(res, nfields * sizeof(PGresAttValue), TRUE); + pqResultAlloc(res, nfields * sizeof(PGresAttValue), true); if (tup == NULL) goto fail; @@ -1674,14 +1674,14 @@ parseInput(PGconn *conn) /* * PQisBusy - * Return TRUE if PQgetResult would block waiting for input. + * Return true if PQgetResult would block waiting for input. */ int PQisBusy(PGconn *conn) { if (!conn) - return FALSE; + return false; /* Parse any available data, if our state permits. */ parseInput(conn); @@ -1720,7 +1720,7 @@ PQgetResult(PGconn *conn) */ while ((flushResult = pqFlush(conn)) > 0) { - if (pqWait(FALSE, TRUE, conn)) + if (pqWait(false, true, conn)) { flushResult = -1; break; @@ -1729,7 +1729,7 @@ PQgetResult(PGconn *conn) /* Wait for some more data, and load it. */ if (flushResult || - pqWait(TRUE, FALSE, conn) || + pqWait(true, false, conn) || pqReadData(conn) < 0) { /* @@ -1793,7 +1793,7 @@ PQgetResult(PGconn *conn) res->resultStatus = PGRES_FATAL_ERROR; break; } - res->events[i].resultInitialized = TRUE; + res->events[i].resultInitialized = true; } } @@ -2695,22 +2695,22 @@ PQbinaryTuples(const PGresult *res) /* * Helper routines to range-check field numbers and tuple numbers. - * Return TRUE if OK, FALSE if not + * Return true if OK, false if not */ static int check_field_number(const PGresult *res, int field_num) { if (!res) - return FALSE; /* no way to display error message... */ + return false; /* no way to display error message... */ if (field_num < 0 || field_num >= res->numAttributes) { pqInternalNotice(&res->noticeHooks, "column number %d is out of range 0..%d", field_num, res->numAttributes - 1); - return FALSE; + return false; } - return TRUE; + return true; } static int @@ -2718,38 +2718,38 @@ check_tuple_field_number(const PGresult *res, int tup_num, int field_num) { if (!res) - return FALSE; /* no way to display error message... */ + return false; /* no way to display error message... */ if (tup_num < 0 || tup_num >= res->ntups) { pqInternalNotice(&res->noticeHooks, "row number %d is out of range 0..%d", tup_num, res->ntups - 1); - return FALSE; + return false; } if (field_num < 0 || field_num >= res->numAttributes) { pqInternalNotice(&res->noticeHooks, "column number %d is out of range 0..%d", field_num, res->numAttributes - 1); - return FALSE; + return false; } - return TRUE; + return true; } static int check_param_number(const PGresult *res, int param_num) { if (!res) - return FALSE; /* no way to display error message... */ + return false; /* no way to display error message... */ if (param_num < 0 || param_num >= res->numParameters) { pqInternalNotice(&res->noticeHooks, "parameter number %d is out of range 0..%d", param_num, res->numParameters - 1); - return FALSE; + return false; } - return TRUE; + return true; } /* @@ -3126,8 +3126,8 @@ PQparamtype(const PGresult *res, int param_num) /* PQsetnonblocking: - * sets the PGconn's database connection non-blocking if the arg is TRUE - * or makes it blocking if the arg is FALSE, this will not protect + * sets the PGconn's database connection non-blocking if the arg is true + * or makes it blocking if the arg is false, this will not protect * you from PQexec(), you'll only be safe when using the non-blocking API. * Needs to be called only on a connected database connection. */ @@ -3139,7 +3139,7 @@ PQsetnonblocking(PGconn *conn, int arg) if (!conn || conn->status == CONNECTION_BAD) return -1; - barg = (arg ? TRUE : FALSE); + barg = (arg ? true : false); /* early out if the socket is already in the state requested */ if (barg == conn->nonblocking) @@ -3162,7 +3162,7 @@ PQsetnonblocking(PGconn *conn, int arg) /* * return the blocking status of the database connection - * TRUE == nonblocking, FALSE == blocking + * true == nonblocking, false == blocking */ int PQisnonblocking(const PGconn *conn) diff --git a/src/interfaces/libpq/fe-misc.c b/src/interfaces/libpq/fe-misc.c index cac6359585..f10c1f87ff 100644 --- a/src/interfaces/libpq/fe-misc.c +++ b/src/interfaces/libpq/fe-misc.c @@ -936,7 +936,7 @@ pqSendSome(PGconn *conn, int len) break; } - if (pqWait(TRUE, TRUE, conn)) + if (pqWait(true, true, conn)) { result = -1; break; diff --git a/src/interfaces/libpq/fe-protocol2.c b/src/interfaces/libpq/fe-protocol2.c index a58f701e18..2af6d65d89 100644 --- a/src/interfaces/libpq/fe-protocol2.c +++ b/src/interfaces/libpq/fe-protocol2.c @@ -584,7 +584,7 @@ pqParseInput2(PGconn *conn) if (conn->result != NULL) { /* Read another tuple of a normal query response */ - if (getAnotherTuple(conn, FALSE)) + if (getAnotherTuple(conn, false)) return; /* getAnotherTuple() moves inStart itself */ continue; @@ -602,7 +602,7 @@ pqParseInput2(PGconn *conn) if (conn->result != NULL) { /* Read another tuple of a normal query response */ - if (getAnotherTuple(conn, TRUE)) + if (getAnotherTuple(conn, true)) return; /* getAnotherTuple() moves inStart itself */ continue; @@ -680,7 +680,7 @@ getRowDescriptions(PGconn *conn) if (nfields > 0) { result->attDescs = (PGresAttDesc *) - pqResultAlloc(result, nfields * sizeof(PGresAttDesc), TRUE); + pqResultAlloc(result, nfields * sizeof(PGresAttDesc), true); if (!result->attDescs) { errmsg = NULL; /* means "out of memory", see below */ @@ -1219,7 +1219,7 @@ pqGetCopyData2(PGconn *conn, char **buffer, int async) if (async) return 0; /* Need to load more data */ - if (pqWait(TRUE, FALSE, conn) || + if (pqWait(true, false, conn) || pqReadData(conn) < 0) return -2; } @@ -1264,7 +1264,7 @@ pqGetline2(PGconn *conn, char *s, int maxlen) else { /* need to load more data */ - if (pqWait(TRUE, FALSE, conn) || + if (pqWait(true, false, conn) || pqReadData(conn) < 0) { result = EOF; @@ -1485,7 +1485,7 @@ pqFunctionCall2(PGconn *conn, Oid fnid, if (needInput) { /* Wait for some data to arrive (or for the channel to close) */ - if (pqWait(TRUE, FALSE, conn) || + if (pqWait(true, false, conn) || pqReadData(conn) < 0) break; } diff --git a/src/interfaces/libpq/fe-protocol3.c b/src/interfaces/libpq/fe-protocol3.c index a484fe80a1..ce72eae23a 100644 --- a/src/interfaces/libpq/fe-protocol3.c +++ b/src/interfaces/libpq/fe-protocol3.c @@ -511,7 +511,7 @@ getRowDescriptions(PGconn *conn, int msgLength) if (nfields > 0) { result->attDescs = (PGresAttDesc *) - pqResultAlloc(result, nfields * sizeof(PGresAttDesc), TRUE); + pqResultAlloc(result, nfields * sizeof(PGresAttDesc), true); if (!result->attDescs) { errmsg = NULL; /* means "out of memory", see below */ @@ -669,7 +669,7 @@ getParamDescriptions(PGconn *conn, int msgLength) if (nparams > 0) { result->paramDescs = (PGresParamDesc *) - pqResultAlloc(result, nparams * sizeof(PGresParamDesc), TRUE); + pqResultAlloc(result, nparams * sizeof(PGresParamDesc), true); if (!result->paramDescs) goto advance_and_error; MemSet(result->paramDescs, 0, nparams * sizeof(PGresParamDesc)); @@ -1467,7 +1467,7 @@ getCopyStart(PGconn *conn, ExecStatusType copytype) if (nfields > 0) { result->attDescs = (PGresAttDesc *) - pqResultAlloc(result, nfields * sizeof(PGresAttDesc), TRUE); + pqResultAlloc(result, nfields * sizeof(PGresAttDesc), true); if (!result->attDescs) goto failure; MemSet(result->attDescs, 0, nfields * sizeof(PGresAttDesc)); @@ -1658,7 +1658,7 @@ pqGetCopyData3(PGconn *conn, char **buffer, int async) if (async) return 0; /* Need to load more data */ - if (pqWait(TRUE, FALSE, conn) || + if (pqWait(true, false, conn) || pqReadData(conn) < 0) return -2; continue; @@ -1716,7 +1716,7 @@ pqGetline3(PGconn *conn, char *s, int maxlen) while ((status = PQgetlineAsync(conn, s, maxlen - 1)) == 0) { /* need to load more data */ - if (pqWait(TRUE, FALSE, conn) || + if (pqWait(true, false, conn) || pqReadData(conn) < 0) { *s = '\0'; @@ -1969,7 +1969,7 @@ pqFunctionCall3(PGconn *conn, Oid fnid, if (needInput) { /* Wait for some data to arrive (or for the channel to close) */ - if (pqWait(TRUE, FALSE, conn) || + if (pqWait(true, false, conn) || pqReadData(conn) < 0) break; } diff --git a/src/interfaces/libpq/libpq-events.c b/src/interfaces/libpq/libpq-events.c index e533017a03..883e2af8f4 100644 --- a/src/interfaces/libpq/libpq-events.c +++ b/src/interfaces/libpq/libpq-events.c @@ -44,12 +44,12 @@ PQregisterEventProc(PGconn *conn, PGEventProc proc, PGEventRegister regevt; if (!proc || !conn || !name || !*name) - return FALSE; /* bad arguments */ + return false; /* bad arguments */ for (i = 0; i < conn->nEvents; i++) { if (conn->events[i].proc == proc) - return FALSE; /* already registered */ + return false; /* already registered */ } if (conn->nEvents >= conn->eventArraySize) @@ -64,7 +64,7 @@ PQregisterEventProc(PGconn *conn, PGEventProc proc, e = (PGEvent *) malloc(newSize * sizeof(PGEvent)); if (!e) - return FALSE; + return false; conn->eventArraySize = newSize; conn->events = e; @@ -73,10 +73,10 @@ PQregisterEventProc(PGconn *conn, PGEventProc proc, conn->events[conn->nEvents].proc = proc; conn->events[conn->nEvents].name = strdup(name); if (!conn->events[conn->nEvents].name) - return FALSE; + return false; conn->events[conn->nEvents].passThrough = passThrough; conn->events[conn->nEvents].data = NULL; - conn->events[conn->nEvents].resultInitialized = FALSE; + conn->events[conn->nEvents].resultInitialized = false; conn->nEvents++; regevt.conn = conn; @@ -84,10 +84,10 @@ PQregisterEventProc(PGconn *conn, PGEventProc proc, { conn->nEvents--; free(conn->events[conn->nEvents].name); - return FALSE; + return false; } - return TRUE; + return true; } /* @@ -100,18 +100,18 @@ PQsetInstanceData(PGconn *conn, PGEventProc proc, void *data) int i; if (!conn || !proc) - return FALSE; + return false; for (i = 0; i < conn->nEvents; i++) { if (conn->events[i].proc == proc) { conn->events[i].data = data; - return TRUE; + return true; } } - return FALSE; + return false; } /* @@ -144,18 +144,18 @@ PQresultSetInstanceData(PGresult *result, PGEventProc proc, void *data) int i; if (!result || !proc) - return FALSE; + return false; for (i = 0; i < result->nEvents; i++) { if (result->events[i].proc == proc) { result->events[i].data = data; - return TRUE; + return true; } } - return FALSE; + return false; } /* @@ -187,7 +187,7 @@ PQfireResultCreateEvents(PGconn *conn, PGresult *res) int i; if (!res) - return FALSE; + return false; for (i = 0; i < res->nEvents; i++) { @@ -199,11 +199,11 @@ PQfireResultCreateEvents(PGconn *conn, PGresult *res) evt.result = res; if (!res->events[i].proc(PGEVT_RESULTCREATE, &evt, res->events[i].passThrough)) - return FALSE; + return false; - res->events[i].resultInitialized = TRUE; + res->events[i].resultInitialized = true; } } - return TRUE; + return true; } diff --git a/src/pl/plpgsql/src/pl_exec.c b/src/pl/plpgsql/src/pl_exec.c index 616f5e30f8..c955604c9b 100644 --- a/src/pl/plpgsql/src/pl_exec.c +++ b/src/pl/plpgsql/src/pl_exec.c @@ -5474,12 +5474,12 @@ exec_for_query(PLpgSQL_execstate *estate, PLpgSQL_stmt_forq *stmt, * a Datum by directly calling ExecEvalExpr(). * * If successful, store results into *result, *isNull, *rettype, *rettypmod - * and return TRUE. If the expression cannot be handled by simple evaluation, - * return FALSE. + * and return true. If the expression cannot be handled by simple evaluation, + * return false. * * Because we only store one execution tree for a simple expression, we * can't handle recursion cases. So, if we see the tree is already busy - * with an evaluation in the current xact, we just return FALSE and let the + * with an evaluation in the current xact, we just return false and let the * caller run the expression the hard way. (Other alternatives such as * creating a new tree for a recursive call either introduce memory leaks, * or add enough bookkeeping to be doubtful wins anyway.) Another case that @@ -6291,7 +6291,7 @@ exec_cast_value(PLpgSQL_execstate *estate, * or NULL if the cast is a mere no-op relabeling. If there's work to be * done, the cast_exprstate field contains an expression evaluation tree * based on a CaseTestExpr input, and the cast_in_use field should be set - * TRUE while executing it. + * true while executing it. * ---------- */ static plpgsql_CastHashEntry * -- 2.14.1
0003-Remove-TRUE-and-FALSE.patch (text/plain, 1.3K) download From dd893cb2b646fd9d372a8ef88ca4e6f7c87c376d 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 3/8] Remove TRUE and FALSE Code should be using true and false. Existing code can be changed to those in a backward compatible way. --- src/include/c.h | 12 ++---------- 1 file changed, 2 insertions(+), 10 deletions(-) diff --git a/src/include/c.h b/src/include/c.h index 9066e3c578..9472afd8b9 100644 --- a/src/include/c.h +++ b/src/include/c.h @@ -27,7 +27,7 @@ * ------- ------------------------------------------------ * 0) pg_config.h and standard system headers * 1) hacks to cope with non-ANSI C compilers - * 2) bool, true, false, TRUE, FALSE, NULL + * 2) bool, true, false, NULL * 3) standard system types * 4) IsValid macros for system types * 5) offsetof, lengthof, endof, alignment @@ -184,7 +184,7 @@ #endif /* ---------------------------------------------------------------- - * Section 2: bool, true, false, TRUE, FALSE, NULL + * Section 2: bool, true, false, NULL * ---------------------------------------------------------------- */ @@ -213,14 +213,6 @@ typedef char bool; typedef bool *BoolPtr; -#ifndef TRUE -#define TRUE 1 -#endif - -#ifndef FALSE -#define FALSE 0 -#endif - /* * NULL * Null pointer. -- 2.14.1
0004-Remove-BoolPtr-type.patch (text/plain, 561B) download From 34128fa0fa50be161bf8db783c9dd597b171614f 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 4/8] Remove BoolPtr type Not used and doesn't seem useful. --- src/include/c.h | 2 -- 1 file changed, 2 deletions(-) diff --git a/src/include/c.h b/src/include/c.h index 9472afd8b9..0f078ea5f0 100644 --- a/src/include/c.h +++ b/src/include/c.h @@ -211,8 +211,6 @@ typedef char bool; #endif #endif /* not C++ */ -typedef bool *BoolPtr; - /* * NULL * Null pointer. -- 2.14.1
0005-Make-casting-between-bool-and-GinTernaryValue-more-r.patch (text/plain, 2.4K) download From af82101621a5ebc18cf5ffd47f68d4b1c7ec979a 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 5/8] Make casting between bool and GinTernaryValue more robust These two types are both defined as char and are supposed to be castable to each other. But when stdbool.h is used, this is not guaranteed. So add provisions for different sizes of bool and define GinTernaryValue accordingly. --- src/backend/utils/adt/tsginidx.c | 2 +- src/include/access/gin.h | 14 ++++++++++---- src/include/c.h | 1 + 3 files changed, 12 insertions(+), 5 deletions(-) diff --git a/src/backend/utils/adt/tsginidx.c b/src/backend/utils/adt/tsginidx.c index aba456ed88..fa792b84dc 100644 --- a/src/backend/utils/adt/tsginidx.c +++ b/src/backend/utils/adt/tsginidx.c @@ -309,7 +309,7 @@ gin_tsquery_consistent(PG_FUNCTION_ARGS) * query. */ gcv.first_item = GETQUERY(query); - gcv.check = check; + gcv.check = (GinTernaryValue *) check; gcv.map_item_operand = (int *) (extra_data[0]); gcv.need_recheck = recheck; diff --git a/src/include/access/gin.h b/src/include/access/gin.h index ec83058095..d58af1d6a1 100644 --- a/src/include/access/gin.h +++ b/src/include/access/gin.h @@ -51,14 +51,20 @@ typedef struct GinStatsData /* * A ternary value used by tri-consistent functions. * - * For convenience, this is compatible with booleans. A boolean can be + * For convenience, this is compatible with bools. A bool can be * safely cast to a GinTernaryValue. */ +#if SIZEOF_BOOL == 1 typedef char GinTernaryValue; +#elif SIZEOF_BOOL == 4 +typedef int GinTernaryValue; +#else +#error unsupported SIZEOF_BOOL +#endif -#define GIN_FALSE 0 /* item is not present / does not match */ -#define GIN_TRUE 1 /* item is present / matches */ -#define GIN_MAYBE 2 /* don't know if item is present / don't know +#define GIN_FALSE ((GinTernaryValue) 0) /* item is not present / does not match */ +#define GIN_TRUE ((GinTernaryValue) 1) /* item is present / matches */ +#define GIN_MAYBE ((GinTernaryValue) 2) /* don't know if item is present / don't know * if matches */ #define DatumGetGinTernaryValue(X) ((GinTernaryValue)(X)) diff --git a/src/include/c.h b/src/include/c.h index 0f078ea5f0..cbf10da66c 100644 --- a/src/include/c.h +++ b/src/include/c.h @@ -200,6 +200,7 @@ #ifndef bool typedef char bool; +#define SIZEOF_BOOL 1 #endif #ifndef true -- 2.14.1
0006-Add-bool8-typedef-for-system-catalog-structs.patch (text/plain, 24.1K) download From 27f6d43da62aeb2b03492826dba60e5f65993130 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 6/8] 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 7abfda3d3a..b11f871b63 100644 --- a/src/backend/catalog/Catalog.pm +++ b/src/backend/catalog/Catalog.pm @@ -31,6 +31,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 cbf10da66c..28f8d2bf75 100644 --- a/src/include/c.h +++ b/src/include/c.h @@ -212,6 +212,15 @@ typedef char bool; #endif #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; + /* * NULL * Null pointer. diff --git a/src/include/catalog/pg_aggregate.h b/src/include/catalog/pg_aggregate.h index 4d5b9bb9a6..98baf5caf5 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; Oid aggsortop; Oid aggtranstype; int32 aggtransspace; 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 0682d7eb22..70a691f8f3 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 28dbc747d5..2eeb304dd2 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 ffabc2003b..23119b642e 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 8b33b4e0ea..4498eb63e8 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 8ae6b7143d..753b2d0e67 100644 --- a/src/include/catalog/pg_sequence.h +++ b/src/include/catalog/pg_sequence.h @@ -14,7 +14,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 3713a56bbd..55f072c56c 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 ffdb452b02..ba4b48c679 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; -- 2.14.1
0007-Avoid-use-of-bool-in-thread_test.c.patch (text/plain, 2.8K) download From 65f7cfa613111949ffbf0dcff4f4aab1fd4f1cb8 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 7/8] Avoid use of bool in thread_test.c It's not necessary for such a small program, and it causes unnecessary extra work to get the correct definition of bool. --- src/test/thread/thread_test.c | 33 ++++++++++----------------------- 1 file changed, 10 insertions(+), 23 deletions(-) diff --git a/src/test/thread/thread_test.c b/src/test/thread/thread_test.c index 32ce80e57f..282a95872c 100644 --- a/src/test/thread/thread_test.c +++ b/src/test/thread/thread_test.c @@ -22,19 +22,6 @@ #if !defined(IN_CONFIGURE) && !defined(WIN32) #include "postgres.h" -#else -/* From src/include/c.h" */ -#ifndef bool -typedef char bool; -#endif - -#ifndef true -#define true ((bool) 1) -#endif - -#ifndef false -#define false ((bool) 0) -#endif #endif #include <stdio.h> @@ -93,23 +80,23 @@ static volatile int errno2_set = 0; #ifndef HAVE_STRERROR_R static char *strerror_p1; static char *strerror_p2; -static bool strerror_threadsafe = false; +static int strerror_threadsafe = 0; #endif #if !defined(WIN32) && !defined(HAVE_GETPWUID_R) static struct passwd *passwd_p1; static struct passwd *passwd_p2; -static bool getpwuid_threadsafe = false; +static int getpwuid_threadsafe = 0; #endif #if !defined(HAVE_GETADDRINFO) && !defined(HAVE_GETHOSTBYNAME_R) static struct hostent *hostent_p1; static struct hostent *hostent_p2; static char myhostname[MAXHOSTNAMELEN]; -static bool gethostbyname_threadsafe = false; +static int gethostbyname_threadsafe = 0; #endif -static bool platform_is_threadsafe = true; +static int platform_is_threadsafe = 1; int main(int argc, char *argv[]) @@ -187,17 +174,17 @@ main(int argc, char *argv[]) #ifndef HAVE_STRERROR_R if (strerror_p1 != strerror_p2) - strerror_threadsafe = true; + strerror_threadsafe = 1; #endif #if !defined(WIN32) && !defined(HAVE_GETPWUID_R) if (passwd_p1 != passwd_p2) - getpwuid_threadsafe = true; + getpwuid_threadsafe = 1; #endif #if !defined(HAVE_GETADDRINFO) && !defined(HAVE_GETHOSTBYNAME_R) if (hostent_p1 != hostent_p2) - gethostbyname_threadsafe = true; + gethostbyname_threadsafe = 1; #endif /* close down threads */ @@ -218,7 +205,7 @@ main(int argc, char *argv[]) else { printf("not thread-safe. **\n"); - platform_is_threadsafe = false; + platform_is_threadsafe = 0; } #endif @@ -233,7 +220,7 @@ main(int argc, char *argv[]) else { printf("not thread-safe. **\n"); - platform_is_threadsafe = false; + platform_is_threadsafe = 0; } #endif @@ -249,7 +236,7 @@ main(int argc, char *argv[]) else { printf("not thread-safe. **\n"); - platform_is_threadsafe = false; + platform_is_threadsafe = 0; } #endif -- 2.14.1
0008-Use-stdbool.h-if-available.patch (text/plain, 12.8K) download From ac7706b80c8225b04a7eb3c7fcd7a9b404578f9e 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 8/8] Use stdbool.h if available While we could do without this, extension code and third-party headers are increasingly pulling this in, creating possible complications. One, bool defined in stdbool.h is not necessarily one byte in size. Two, it can only contain values 0 or 1 on output. So having multiple definitions of bool in play depending on include file order could create a mess. So we just get on board with this and use stdbool.h always if available. As a benefit, some recent compilers can give some better warnings if the official bool type is used. --- configure | 210 ++++++++++++++++++++++++++++++++++++--------- configure.in | 4 + src/include/c.h | 23 ++--- src/include/pg_config.h.in | 9 ++ src/pl/plperl/plperl.h | 10 +-- 5 files changed, 200 insertions(+), 56 deletions(-) diff --git a/configure b/configure index a2f9a256b4..e7b74adb13 100755 --- a/configure +++ b/configure @@ -2001,116 +2001,116 @@ $as_echo "$ac_res" >&6; } } # ac_fn_c_check_func -# ac_fn_c_check_member LINENO AGGR MEMBER VAR INCLUDES -# ---------------------------------------------------- -# Tries to find if the field MEMBER exists in type AGGR, after including -# INCLUDES, setting cache variable VAR accordingly. -ac_fn_c_check_member () +# ac_fn_c_check_type LINENO TYPE VAR INCLUDES +# ------------------------------------------- +# Tests whether TYPE exists after having included INCLUDES, setting cache +# variable VAR accordingly. +ac_fn_c_check_type () { as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack - { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $2.$3" >&5 -$as_echo_n "checking for $2.$3... " >&6; } -if eval \${$4+:} false; then : + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $2" >&5 +$as_echo_n "checking for $2... " >&6; } +if eval \${$3+:} false; then : $as_echo_n "(cached) " >&6 else + eval "$3=no" cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ -$5 +$4 int main () { -static $2 ac_aggr; -if (ac_aggr.$3) -return 0; +if (sizeof ($2)) + return 0; ; return 0; } _ACEOF if ac_fn_c_try_compile "$LINENO"; then : - eval "$4=yes" -else cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ -$5 +$4 int main () { -static $2 ac_aggr; -if (sizeof ac_aggr.$3) -return 0; +if (sizeof (($2))) + return 0; ; return 0; } _ACEOF if ac_fn_c_try_compile "$LINENO"; then : - eval "$4=yes" + else - eval "$4=no" + eval "$3=yes" fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext fi -eval ac_res=\$$4 +eval ac_res=\$$3 { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5 $as_echo "$ac_res" >&6; } eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno -} # ac_fn_c_check_member +} # ac_fn_c_check_type -# ac_fn_c_check_type LINENO TYPE VAR INCLUDES -# ------------------------------------------- -# Tests whether TYPE exists after having included INCLUDES, setting cache -# variable VAR accordingly. -ac_fn_c_check_type () +# ac_fn_c_check_member LINENO AGGR MEMBER VAR INCLUDES +# ---------------------------------------------------- +# Tries to find if the field MEMBER exists in type AGGR, after including +# INCLUDES, setting cache variable VAR accordingly. +ac_fn_c_check_member () { as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack - { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $2" >&5 -$as_echo_n "checking for $2... " >&6; } -if eval \${$3+:} false; then : + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $2.$3" >&5 +$as_echo_n "checking for $2.$3... " >&6; } +if eval \${$4+:} false; then : $as_echo_n "(cached) " >&6 else - eval "$3=no" cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ -$4 +$5 int main () { -if (sizeof ($2)) - return 0; +static $2 ac_aggr; +if (ac_aggr.$3) +return 0; ; return 0; } _ACEOF if ac_fn_c_try_compile "$LINENO"; then : + eval "$4=yes" +else cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ -$4 +$5 int main () { -if (sizeof (($2))) - return 0; +static $2 ac_aggr; +if (sizeof ac_aggr.$3) +return 0; ; return 0; } _ACEOF if ac_fn_c_try_compile "$LINENO"; then : - + eval "$4=yes" else - eval "$3=yes" + eval "$4=no" fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext fi -eval ac_res=\$$3 +eval ac_res=\$$4 { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5 $as_echo "$ac_res" >&6; } eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno -} # ac_fn_c_check_type +} # ac_fn_c_check_member # ac_fn_c_compute_int LINENO EXPR VAR INCLUDES # -------------------------------------------- @@ -10732,6 +10732,100 @@ fi ## Header files ## +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for stdbool.h that conforms to C99" >&5 +$as_echo_n "checking for stdbool.h that conforms to C99... " >&6; } +if ${ac_cv_header_stdbool_h+:} false; then : + $as_echo_n "(cached) " >&6 +else + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + + #include <stdbool.h> + #ifndef bool + "error: bool is not defined" + #endif + #ifndef false + "error: false is not defined" + #endif + #if false + "error: false is not 0" + #endif + #ifndef true + "error: true is not defined" + #endif + #if true != 1 + "error: true is not 1" + #endif + #ifndef __bool_true_false_are_defined + "error: __bool_true_false_are_defined is not defined" + #endif + + struct s { _Bool s: 1; _Bool t; } s; + + char a[true == 1 ? 1 : -1]; + char b[false == 0 ? 1 : -1]; + char c[__bool_true_false_are_defined == 1 ? 1 : -1]; + char d[(bool) 0.5 == true ? 1 : -1]; + /* See body of main program for 'e'. */ + char f[(_Bool) 0.0 == false ? 1 : -1]; + char g[true]; + char h[sizeof (_Bool)]; + char i[sizeof s.t]; + enum { j = false, k = true, l = false * true, m = true * 256 }; + /* The following fails for + HP aC++/ANSI C B3910B A.05.55 [Dec 04 2003]. */ + _Bool n[m]; + char o[sizeof n == m * sizeof n[0] ? 1 : -1]; + char p[-1 - (_Bool) 0 < 0 && -1 - (bool) 0 < 0 ? 1 : -1]; + /* Catch a bug in an HP-UX C compiler. See + http://gcc.gnu.org/ml/gcc-patches/2003-12/msg02303.html + http://lists.gnu.org/archive/html/bug-coreutils/2005-11/msg00161.html + */ + _Bool q = true; + _Bool *pq = &q; + +int +main () +{ + + bool e = &s; + *pq |= q; + *pq |= ! q; + /* Refer to every declared value, to avoid compiler optimizations. */ + return (!a + !b + !c + !d + !e + !f + !g + !h + !i + !!j + !k + !!l + + !m + !n + !o + !p + !q + !pq); + + ; + return 0; +} +_ACEOF +if ac_fn_c_try_compile "$LINENO"; then : + ac_cv_header_stdbool_h=yes +else + ac_cv_header_stdbool_h=no +fi +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_header_stdbool_h" >&5 +$as_echo "$ac_cv_header_stdbool_h" >&6; } + ac_fn_c_check_type "$LINENO" "_Bool" "ac_cv_type__Bool" "$ac_includes_default" +if test "x$ac_cv_type__Bool" = xyes; then : + +cat >>confdefs.h <<_ACEOF +#define HAVE__BOOL 1 +_ACEOF + + +fi + + +if test $ac_cv_header_stdbool_h = yes; then + +$as_echo "#define HAVE_STDBOOL_H 1" >>confdefs.h + +fi + + for ac_header in atomic.h crypt.h dld.h fp_class.h getopt.h ieeefp.h ifaddrs.h langinfo.h mbarrier.h poll.h sys/epoll.h sys/ipc.h sys/pstat.h sys/resource.h sys/select.h sys/sem.h sys/shm.h sys/sockio.h sys/tas.h sys/un.h termios.h ucred.h utime.h wchar.h wctype.h do : as_ac_Header=`$as_echo "ac_cv_header_$ac_header" | $as_tr_sh` @@ -12818,6 +12912,40 @@ if test "$ac_cv_sizeof_off_t" -lt 8 -a "$segsize" != "1"; then as_fn_error $? "Large file support is not enabled. Segment size cannot be larger than 1GB." "$LINENO" 5 fi +# The cast to long int works around a bug in the HP C Compiler +# version HP92453-01 B.11.11.23709.GP, which incorrectly rejects +# declarations like `int a3[[(sizeof (unsigned char)) >= 0]];'. +# This bug is HP SR number 8606223364. +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking size of _Bool" >&5 +$as_echo_n "checking size of _Bool... " >&6; } +if ${ac_cv_sizeof__Bool+:} false; then : + $as_echo_n "(cached) " >&6 +else + if ac_fn_c_compute_int "$LINENO" "(long int) (sizeof (_Bool))" "ac_cv_sizeof__Bool" "$ac_includes_default"; then : + +else + if test "$ac_cv_type__Bool" = yes; then + { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 +$as_echo "$as_me: error: in \`$ac_pwd':" >&2;} +as_fn_error 77 "cannot compute sizeof (_Bool) +See \`config.log' for more details" "$LINENO" 5; } + else + ac_cv_sizeof__Bool=0 + fi +fi + +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_sizeof__Bool" >&5 +$as_echo "$ac_cv_sizeof__Bool" >&6; } + + + +cat >>confdefs.h <<_ACEOF +#define SIZEOF__BOOL $ac_cv_sizeof__Bool +_ACEOF + + + ## ## Functions, global variables diff --git a/configure.in b/configure.in index e94fba5235..0700ec8fb3 100644 --- a/configure.in +++ b/configure.in @@ -1180,6 +1180,8 @@ AC_SUBST(UUID_LIBS) ## Header files ## +AC_HEADER_STDBOOL + AC_CHECK_HEADERS([atomic.h crypt.h dld.h fp_class.h getopt.h ieeefp.h ifaddrs.h langinfo.h mbarrier.h poll.h sys/epoll.h sys/ipc.h sys/pstat.h sys/resource.h sys/select.h sys/sem.h sys/shm.h sys/sockio.h sys/tas.h sys/un.h termios.h ucred.h utime.h wchar.h wctype.h]) # On BSD, test for net/if.h will fail unless sys/socket.h @@ -1413,6 +1415,8 @@ if test "$ac_cv_sizeof_off_t" -lt 8 -a "$segsize" != "1"; then AC_MSG_ERROR([Large file support is not enabled. Segment size cannot be larger than 1GB.]) fi +AC_CHECK_SIZEOF(_Bool) + ## ## Functions, global variables diff --git a/src/include/c.h b/src/include/c.h index 28f8d2bf75..7320c9d796 100644 --- a/src/include/c.h +++ b/src/include/c.h @@ -192,24 +192,27 @@ * bool * Boolean value, either true or false. * - * XXX for C++ compilers, we assume the compiler has a compatible + * Use stdbool.h if available, to ensure best compatibility with third-party + * libraries. For C++ compilers, we assume the compiler has a compatible * built-in definition of bool. */ #ifndef __cplusplus -#ifndef bool -typedef char bool; -#define SIZEOF_BOOL 1 +#ifdef HAVE_STDBOOL_H +#include <stdbool.h> +#else +#ifndef HAVE__BOOL +#define _Bool signed char +#define SIZEOF__BOOL 1 #endif - -#ifndef true -#define true ((bool) 1) +#define bool _Bool +#define false 0 +#define true 1 #endif -#ifndef false -#define false ((bool) 0) -#endif +#define SIZEOF_BOOL SIZEOF__BOOL + #endif /* not C++ */ /* diff --git a/src/include/pg_config.h.in b/src/include/pg_config.h.in index dcb7a1a320..2d39812ea2 100644 --- a/src/include/pg_config.h.in +++ b/src/include/pg_config.h.in @@ -473,6 +473,9 @@ /* Define to 1 if you have the `SSL_get_current_compression' function. */ #undef HAVE_SSL_GET_CURRENT_COMPRESSION +/* Define to 1 if stdbool.h conforms to C99. */ +#undef HAVE_STDBOOL_H + /* Define to 1 if you have the <stdint.h> header file. */ #undef HAVE_STDINT_H @@ -675,6 +678,9 @@ /* Define to 1 if you have the <winldap.h> header file. */ #undef HAVE_WINLDAP_H +/* Define to 1 if the system has the type `_Bool'. */ +#undef HAVE__BOOL + /* Define to 1 if your compiler understands __builtin_bswap32. */ #undef HAVE__BUILTIN_BSWAP32 @@ -790,6 +796,9 @@ /* The size of `void *', as computed by sizeof. */ #undef SIZEOF_VOID_P +/* The size of `_Bool', as computed by sizeof. */ +#undef SIZEOF__BOOL + /* Define to 1 if you have the ANSI C header files. */ #undef STDC_HEADERS diff --git a/src/pl/plperl/plperl.h b/src/pl/plperl/plperl.h index c4e06d089f..f144813e94 100644 --- a/src/pl/plperl/plperl.h +++ b/src/pl/plperl/plperl.h @@ -42,6 +42,11 @@ #undef vsnprintf #endif +/* + * Prevent perl from redefining "bool". + */ +#define HAS_BOOL 1 + /* * Get the basic Perl API. We use PERL_NO_GET_CONTEXT mode so that our code @@ -83,11 +88,6 @@ #define NEED_sv_2pv_flags #include "ppport.h" -/* perl may have a different width of "bool", don't buy it */ -#ifdef bool -#undef bool -#endif - /* supply HeUTF8 if it's missing - ppport.h doesn't supply it, unfortunately */ #ifndef HeUTF8 #define HeUTF8(he) ((HeKLEN(he) == HEf_SVKEY) ? \ -- 2.14.1

view thread (60+ messages)  latest in thread

Message-ID: <3a0fe7e1-5ed1-414b-9230-53bbc0ed1f49@2ndquadrant.com>
Permalink:  ../3a0fe7e1-5ed1-414b-9230-53bbc0ed1f49@2ndquadrant.com/
Also on:    postgresql.org/message-id/3a0fe7e1-5ed1-414b-9230-53bbc0ed1f49@2ndquadrant.com

 ·  · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients using the --to and --cc options:
  reply via email

  To: pgsql-hackers@postgresql.org
  Cc: peter.eisentraut@2ndquadrant.com
  Subject: Re: taking stdbool.h into use
  In-Reply-To: <3a0fe7e1-5ed1-414b-9230-53bbc0ed1f49@2ndquadrant.com>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox