typos

Started by Justin Pryzbyover 4 years ago10 messages
#1Justin Pryzby
pryzby@telsasoft.com
11 attachment(s)

A compilation of fixes for master.

The first patch should be applied to v13 - the typo was already fixed in master
but not backpatched.

Attachments:

0001-unused-COLUMNS-plural.patch13-text/plain; charset=us-asciiDownload
From 8496bfa328d40cce9afdc4b491243a3ab9b0b528 Mon Sep 17 00:00:00 2001
From: Justin Pryzby <pryzbyj@telsasoft.com>
Date: Fri, 24 Sep 2021 16:19:54 -0500
Subject: [PATCH] unused COLUMNS (plural)

This was fixed in master since 1ed6b8956, but the typo should be backpatched
since it's user-facing documentation publicized on the website for the next 5
years
---
 doc/src/sgml/catalogs.sgml | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/doc/src/sgml/catalogs.sgml b/doc/src/sgml/catalogs.sgml
index 304196c216..0e4d7617c4 100644
--- a/doc/src/sgml/catalogs.sgml
+++ b/doc/src/sgml/catalogs.sgml
@@ -4704,7 +4704,7 @@ SCRAM-SHA-256$<replaceable>&lt;iteration count&gt;</replaceable>:<replaceable>&l
   </table>
 
   <para>
-   Unused column contain zeroes. For example, <structfield>oprleft</structfield>
+   Unused columns contain zeroes. For example, <structfield>oprleft</structfield>
    is zero for a prefix operator.
   </para>
 
-- 
2.17.0

0001-Avoid-double-parens.patchtext/x-diff; charset=us-asciiDownload
From f65f3b4d7523ba2e40bb4913fd225308426f7a9c Mon Sep 17 00:00:00 2001
From: Justin Pryzby <pryzbyj@telsasoft.com>
Date: Wed, 28 Apr 2021 14:12:49 -0500
Subject: [PATCH 01/10] Avoid double parens

git grep -l '\<if (([^(]*))' '*.c'
---
 contrib/amcheck/verify_heapam.c          | 6 +++---
 contrib/ltree/ltree_io.c                 | 6 +++---
 src/backend/access/transam/xact.c        | 6 +++---
 src/backend/commands/tablecmds.c         | 2 +-
 src/backend/nodes/nodeFuncs.c            | 4 ++--
 src/backend/replication/logical/decode.c | 2 +-
 6 files changed, 13 insertions(+), 13 deletions(-)

diff --git a/contrib/amcheck/verify_heapam.c b/contrib/amcheck/verify_heapam.c
index 173f99d787..0ac52b6ba2 100644
--- a/contrib/amcheck/verify_heapam.c
+++ b/contrib/amcheck/verify_heapam.c
@@ -406,13 +406,13 @@ verify_heapam(PG_FUNCTION_ARGS)
 													   &vmbuffer);
 			if (skip_option == SKIP_PAGES_ALL_FROZEN)
 			{
-				if ((mapbits & VISIBILITYMAP_ALL_FROZEN) != 0)
+				if (mapbits & VISIBILITYMAP_ALL_FROZEN)
 					continue;
 			}
 
 			if (skip_option == SKIP_PAGES_ALL_VISIBLE)
 			{
-				if ((mapbits & VISIBILITYMAP_ALL_VISIBLE) != 0)
+				if (mapbits & VISIBILITYMAP_ALL_VISIBLE)
 					continue;
 			}
 		}
@@ -690,7 +690,7 @@ check_tuple_header(HeapCheckContext *ctx)
 			report_corruption(ctx,
 							  psprintf("tuple data should begin at byte %u, but actually begins at byte %u (1 attribute, has nulls)",
 									   expected_hoff, ctx->tuphdr->t_hoff));
-		else if ((infomask & HEAP_HASNULL))
+		else if (infomask & HEAP_HASNULL)
 			report_corruption(ctx,
 							  psprintf("tuple data should begin at byte %u, but actually begins at byte %u (%u attributes, has nulls)",
 									   expected_hoff, ctx->tuphdr->t_hoff, ctx->natts));
diff --git a/contrib/ltree/ltree_io.c b/contrib/ltree/ltree_io.c
index 15115cb29f..b75f35d5b5 100644
--- a/contrib/ltree/ltree_io.c
+++ b/contrib/ltree/ltree_io.c
@@ -661,17 +661,17 @@ deparse_lquery(const lquery *in)
 				}
 				memcpy(ptr, curtlevel->name, curtlevel->len);
 				ptr += curtlevel->len;
-				if ((curtlevel->flag & LVAR_SUBLEXEME))
+				if (curtlevel->flag & LVAR_SUBLEXEME)
 				{
 					*ptr = '%';
 					ptr++;
 				}
-				if ((curtlevel->flag & LVAR_INCASE))
+				if (curtlevel->flag & LVAR_INCASE)
 				{
 					*ptr = '@';
 					ptr++;
 				}
-				if ((curtlevel->flag & LVAR_ANYEND))
+				if (curtlevel->flag & LVAR_ANYEND)
 				{
 					*ptr = '*';
 					ptr++;
diff --git a/src/backend/access/transam/xact.c b/src/backend/access/transam/xact.c
index 6597ec45a9..8350a8fd19 100644
--- a/src/backend/access/transam/xact.c
+++ b/src/backend/access/transam/xact.c
@@ -2427,7 +2427,7 @@ PrepareTransaction(void)
 	 * cases, such as a temp table created and dropped all within the
 	 * transaction.  That seems to require much more bookkeeping though.
 	 */
-	if ((MyXactFlags & XACT_FLAGS_ACCESSEDTEMPNAMESPACE))
+	if (MyXactFlags & XACT_FLAGS_ACCESSEDTEMPNAMESPACE)
 		ereport(ERROR,
 				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
 				 errmsg("cannot PREPARE a transaction that has operated on temporary objects")));
@@ -5540,7 +5540,7 @@ XactLogCommitRecord(TimestampTz commit_time,
 		xl_xinfo.xinfo |= XACT_COMPLETION_UPDATE_RELCACHE_FILE;
 	if (forceSyncCommit)
 		xl_xinfo.xinfo |= XACT_COMPLETION_FORCE_SYNC_COMMIT;
-	if ((xactflags & XACT_FLAGS_ACQUIREDACCESSEXCLUSIVELOCK))
+	if (xactflags & XACT_FLAGS_ACQUIREDACCESSEXCLUSIVELOCK)
 		xl_xinfo.xinfo |= XACT_XINFO_HAS_AE_LOCKS;
 
 	/*
@@ -5691,7 +5691,7 @@ XactLogAbortRecord(TimestampTz abort_time,
 
 	xlrec.xact_time = abort_time;
 
-	if ((xactflags & XACT_FLAGS_ACQUIREDACCESSEXCLUSIVELOCK))
+	if (xactflags & XACT_FLAGS_ACQUIREDACCESSEXCLUSIVELOCK)
 		xl_xinfo.xinfo |= XACT_XINFO_HAS_AE_LOCKS;
 
 	if (nsubxacts > 0)
diff --git a/src/backend/commands/tablecmds.c b/src/backend/commands/tablecmds.c
index dbee6ae199..e018cdfd9e 100644
--- a/src/backend/commands/tablecmds.c
+++ b/src/backend/commands/tablecmds.c
@@ -16309,7 +16309,7 @@ PreCommit_on_commit_actions(void)
 				 * relations, we can skip truncating ON COMMIT DELETE ROWS
 				 * tables, as they must still be empty.
 				 */
-				if ((MyXactFlags & XACT_FLAGS_ACCESSEDTEMPNAMESPACE))
+				if (MyXactFlags & XACT_FLAGS_ACCESSEDTEMPNAMESPACE)
 					oids_to_truncate = lappend_oid(oids_to_truncate, oc->relid);
 				break;
 			case ONCOMMIT_DROP:
diff --git a/src/backend/nodes/nodeFuncs.c b/src/backend/nodes/nodeFuncs.c
index e276264882..e5e82cb85f 100644
--- a/src/backend/nodes/nodeFuncs.c
+++ b/src/backend/nodes/nodeFuncs.c
@@ -2390,7 +2390,7 @@ query_tree_walker(Query *query,
 	 * don't contain actual expressions. However they do contain OIDs which
 	 * may be needed by dependency walkers etc.
 	 */
-	if ((flags & QTW_EXAMINE_SORTGROUP))
+	if (flags & QTW_EXAMINE_SORTGROUP)
 	{
 		if (walker((Node *) query->groupClause, context))
 			return true;
@@ -3328,7 +3328,7 @@ query_tree_mutator(Query *query,
 	 * may be of interest to some mutators.
 	 */
 
-	if ((flags & QTW_EXAMINE_SORTGROUP))
+	if (flags & QTW_EXAMINE_SORTGROUP)
 	{
 		MUTATE(query->groupClause, query->groupClause, List *);
 		MUTATE(query->windowClause, query->windowClause, List *);
diff --git a/src/backend/replication/logical/decode.c b/src/backend/replication/logical/decode.c
index 2874dc0612..fc9a0d67c9 100644
--- a/src/backend/replication/logical/decode.c
+++ b/src/backend/replication/logical/decode.c
@@ -337,7 +337,7 @@ DecodeXactOp(LogicalDecodingContext *ctx, XLogRecordBuffer *buf)
 					ReorderBufferXidSetCatalogChanges(ctx->reorder, xid,
 													  buf->origptr);
 				}
-				else if ((!ctx->fast_forward))
+				else if (!ctx->fast_forward)
 					ReorderBufferImmediateInvalidation(ctx->reorder,
 													   invals->nmsgs,
 													   invals->msgs);
-- 
2.17.0

0002-Deforming-is-never-done-for-Virtual-TTS-since-36d22d.patchtext/x-diff; charset=us-asciiDownload
From 1a29c1f78a3db80843a6358d810ba9988978bd76 Mon Sep 17 00:00:00 2001
From: Justin Pryzby <pryzbyj@telsasoft.com>
Date: Sat, 24 Apr 2021 17:02:52 -0500
Subject: [PATCH 02/10] Deforming is never done for Virtual TTS since
 36d22dd95bc87ca68e742da91f47f8826f8758c9

---
 src/backend/jit/llvm/llvmjit_deform.c | 4 +---
 1 file changed, 1 insertion(+), 3 deletions(-)

diff --git a/src/backend/jit/llvm/llvmjit_deform.c b/src/backend/jit/llvm/llvmjit_deform.c
index 008cd617f6..3221f28b8f 100644
--- a/src/backend/jit/llvm/llvmjit_deform.c
+++ b/src/backend/jit/llvm/llvmjit_deform.c
@@ -89,9 +89,7 @@ slot_compile_deform(LLVMJitContext *context, TupleDesc desc,
 
 	int			attnum;
 
-	/* virtual tuples never need deforming, so don't generate code */
-	if (ops == &TTSOpsVirtual)
-		return NULL;
+	Assert (ops != &TTSOpsVirtual);
 
 	/* decline to JIT for slot types we don't know to handle */
 	if (ops != &TTSOpsHeapTuple && ops != &TTSOpsBufferHeapTuple &&
-- 
2.17.0

0003-Fix-comment-wrong-since-bf2a691e02d7766f185d9d8e0f09.patchtext/x-diff; charset=us-asciiDownload
From c60b92790cad887c17c5fe5db2461cda7e269412 Mon Sep 17 00:00:00 2001
From: Justin Pryzby <pryzbyj@telsasoft.com>
Date: Fri, 20 Aug 2021 19:40:52 -0500
Subject: [PATCH 03/10] Fix comment wrong since
 bf2a691e02d7766f185d9d8e0f092222a5c0a129

---
 src/backend/statistics/extended_stats.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/src/backend/statistics/extended_stats.c b/src/backend/statistics/extended_stats.c
index 5fa36e0036..542271c9e4 100644
--- a/src/backend/statistics/extended_stats.c
+++ b/src/backend/statistics/extended_stats.c
@@ -701,7 +701,7 @@ examine_expression(Node *expr, int stattarget)
 /*
  * Using 'vacatts' of size 'nvacatts' as input data, return a newly built
  * VacAttrStats array which includes only the items corresponding to
- * attributes indicated by 'stxkeys'. If we don't have all of the per column
+ * attributes indicated by 'attrs'. If we don't have all of the per column
  * stats available to compute the extended stats, then we return NULL to indicate
  * to the caller that the stats should not be built.
  */
-- 
2.17.0

0004-tablefunc.c-Fix-comment.patchtext/x-diff; charset=us-asciiDownload
From 4f625ad0574d3a56153cc05edacbbad717fc82e0 Mon Sep 17 00:00:00 2001
From: Justin Pryzby <pryzbyj@telsasoft.com>
Date: Sat, 8 May 2021 08:12:46 -0500
Subject: [PATCH 04/10] tablefunc.c: Fix comment

Mentioned at: https://www.postgresql.org/message-id/CAJRYxuKmMkgHFKjuYPxThdT5Mjg%2Bg-nH5szYbS8UoVsQXzd95A%40mail.gmail.com
---
 contrib/tablefunc/tablefunc.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/contrib/tablefunc/tablefunc.c b/contrib/tablefunc/tablefunc.c
index 779bd4415e..52b272f298 100644
--- a/contrib/tablefunc/tablefunc.c
+++ b/contrib/tablefunc/tablefunc.c
@@ -1480,7 +1480,7 @@ validateConnectbyTupleDesc(TupleDesc td, bool show_branch, bool show_serial)
 						"fifth column must be type %s",
 						format_type_be(INT4OID))));
 
-	/* check that the type of the fifth column is INT4 */
+	/* check that the type of the fourth column is INT4 */
 	if (!show_branch && show_serial &&
 		TupleDescAttr(td, 3)->atttypid != INT4OID)
 		ereport(ERROR,
-- 
2.17.0

0005-Language-fixen-interval-round-values-when-spilling-t.patchtext/x-diff; charset=us-asciiDownload
From 2e01267cd3473e5e4042594c28cda553a8624929 Mon Sep 17 00:00:00 2001
From: Justin Pryzby <pryzbyj@telsasoft.com>
Date: Sun, 8 Aug 2021 04:42:07 -0500
Subject: [PATCH 05/10] Language fixen: interval:  round values when spilling
 to months

95ab1e0a9db321dd796344d526457016eada027f
---
 doc/src/sgml/datatype.sgml | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/doc/src/sgml/datatype.sgml b/doc/src/sgml/datatype.sgml
index 50a2c8e5f1..6929f3bb18 100644
--- a/doc/src/sgml/datatype.sgml
+++ b/doc/src/sgml/datatype.sgml
@@ -2844,7 +2844,7 @@ P <optional> <replaceable>years</replaceable>-<replaceable>months</replaceable>-
      weeks'</literal> or <literal>'01:02:03.45'</literal>.  However,
      because interval internally stores only three integer units (months,
      days, microseconds), fractional units must be spilled to smaller
-     units.  Fractional parts of units greater than months is rounded to
+     units.  Fractional parts of units greater than months are rounded to
      be an integer number of months, e.g. <literal>'1.5 years'</literal>
      becomes <literal>'1 year 6 mons'</literal>.  Fractional parts of
      weeks and days are computed to be an integer number of days and
-- 
2.17.0

0006-Refer-to-plural-statistics-OBJECTS.patchtext/x-diff; charset=us-asciiDownload
From 4de9716fa39c4fa4fcce3ce80432bc06dda94f91 Mon Sep 17 00:00:00 2001
From: Justin Pryzby <pryzbyj@telsasoft.com>
Date: Sun, 12 Sep 2021 23:45:05 -0500
Subject: [PATCH 06/10] Refer to plural statistics OBJECTS

See also: f04c9a61468904b6815b2bc73a48878817766e0e
---
 src/backend/commands/statscmds.c        |  4 ++--
 src/backend/statistics/extended_stats.c | 12 ++++++------
 src/backend/utils/adt/selfuncs.c        |  2 +-
 3 files changed, 9 insertions(+), 9 deletions(-)

diff --git a/src/backend/commands/statscmds.c b/src/backend/commands/statscmds.c
index afe6744e23..d6be3218ad 100644
--- a/src/backend/commands/statscmds.c
+++ b/src/backend/commands/statscmds.c
@@ -869,8 +869,8 @@ ChooseExtendedStatisticNameAddition(List *exprs)
 }
 
 /*
- * StatisticsGetRelation: given a statistics's relation OID, get the OID of
- * the relation it is an statistics on.  Uses the system cache.
+ * StatisticsGetRelation: given a statistics object's OID, get the OID of
+ * the relation it is defined on.  Uses the system cache.
  */
 Oid
 StatisticsGetRelation(Oid statId, bool missing_ok)
diff --git a/src/backend/statistics/extended_stats.c b/src/backend/statistics/extended_stats.c
index 542271c9e4..0a7d12d467 100644
--- a/src/backend/statistics/extended_stats.c
+++ b/src/backend/statistics/extended_stats.c
@@ -182,7 +182,7 @@ BuildRelationExtStatistics(Relation onerel, double totalrows,
 			continue;
 		}
 
-		/* compute statistics target for this statistics */
+		/* compute statistics target for this statistics object */
 		stattarget = statext_compute_stattarget(stat->stattarget,
 												bms_num_members(stat->columns),
 												stats);
@@ -195,7 +195,7 @@ BuildRelationExtStatistics(Relation onerel, double totalrows,
 		if (stattarget == 0)
 			continue;
 
-		/* evaluate expressions (if the statistics has any) */
+		/* evaluate expressions (if the statistics object has any) */
 		data = make_build_data(onerel, stat, numrows, rows, stats, stattarget);
 
 		/* compute statistic of each requested type */
@@ -257,7 +257,7 @@ BuildRelationExtStatistics(Relation onerel, double totalrows,
  * when analyzing only some of the columns, this will skip statistics objects
  * that would require additional columns.
  *
- * See statext_compute_stattarget for details about how we compute statistics
+ * See statext_compute_stattarget for details about how we compute the statistics
  * target for a statistics object (from the object target, attribute targets
  * and default statistics target).
  */
@@ -329,7 +329,7 @@ ComputeExtStatisticsRows(Relation onerel,
  *
  * When computing target for extended statistics objects, we consider three
  * places where the target may be set - the statistics object itself,
- * attributes the statistics is defined on, and then the default statistics
+ * attributes the statistics object is defined on, and then the default statistics
  * target.
  *
  * First we look at what's set for the statistics object itself, using the
@@ -1789,8 +1789,8 @@ statext_mcv_clauselist_selectivity(PlannerInfo *root, List *clauses, int varReli
 
 			/*
 			 * The clause was not estimated yet, and we've extracted either
-			 * attnums of expressions from it. Ignore it if it's not fully
-			 * covered by the chosen statistics.
+			 * attnums or expressions from it. Ignore it if it's not fully
+			 * covered by the chosen statistics object.
 			 *
 			 * We need to check both attributes and expressions, and reject if
 			 * either is not covered.
diff --git a/src/backend/utils/adt/selfuncs.c b/src/backend/utils/adt/selfuncs.c
index 0c8c05f6c2..65ab651eb5 100644
--- a/src/backend/utils/adt/selfuncs.c
+++ b/src/backend/utils/adt/selfuncs.c
@@ -3443,7 +3443,7 @@ estimate_num_groups(PlannerInfo *root, List *groupExprs, double input_rows,
 		 * expression, treat it as a single variable even if it's really more
 		 * complicated.
 		 *
-		 * XXX This has the consequence that if there's a statistics on the
+		 * XXX This has the consequence that if there's a statistics object on the
 		 * expression, we don't split it into individual Vars. This affects
 		 * our selection of statistics in estimate_multivariate_ndistinct,
 		 * because it's probably better to use more accurate estimate for each
-- 
2.17.0

0007-Recheck-arg-is-not-needed-since-2011.patchtext/x-diff; charset=us-asciiDownload
From 06edd9994d405497e342dff41798123939072532 Mon Sep 17 00:00:00 2001
From: Justin Pryzby <pryzbyj@telsasoft.com>
Date: Fri, 24 Sep 2021 14:18:52 -0500
Subject: [PATCH 07/10] Recheck arg is not needed since 2011

It was added at: a4dde3bff36dac1ac0b699becad6f103d861a874
And not used since: 7e2f906201c8bb95f7fb17e56b8740c38bda5441
---
 src/backend/commands/cluster.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/src/backend/commands/cluster.c b/src/backend/commands/cluster.c
index 9d22f648a8..ef9485c833 100644
--- a/src/backend/commands/cluster.c
+++ b/src/backend/commands/cluster.c
@@ -398,7 +398,7 @@ cluster_rel(Oid tableOid, Oid indexOid, ClusterParams *params)
 
 	/* Check heap and index are valid to cluster on */
 	if (OidIsValid(indexOid))
-		check_index_is_clusterable(OldHeap, indexOid, recheck, AccessExclusiveLock);
+		check_index_is_clusterable(OldHeap, indexOid, AccessExclusiveLock);
 
 	/*
 	 * Quietly ignore the request if this is a materialized view which has not
@@ -440,7 +440,7 @@ cluster_rel(Oid tableOid, Oid indexOid, ClusterParams *params)
  * protection here.
  */
 void
-check_index_is_clusterable(Relation OldHeap, Oid indexOid, bool recheck, LOCKMODE lockmode)
+check_index_is_clusterable(Relation OldHeap, Oid indexOid, LOCKMODE lockmode)
 {
 	Relation	OldIndex;
 
-- 
2.17.0

0008-Add-some-missing-newlines-after-function-definitions.patchtext/x-diff; charset=us-asciiDownload
From 435b990351aa49b756952c95b089345b6333ba4e Mon Sep 17 00:00:00 2001
From: Justin Pryzby <pryzbyj@telsasoft.com>
Date: Mon, 5 Jul 2021 11:16:38 -0500
Subject: [PATCH 08/10] Add some missing newlines after function definitions

---
 src/backend/access/gin/ginlogic.c      | 1 +
 src/backend/access/rmgrdesc/heapdesc.c | 1 +
 src/backend/utils/mmgr/freepage.c      | 1 +
 3 files changed, 3 insertions(+)

diff --git a/src/backend/access/gin/ginlogic.c b/src/backend/access/gin/ginlogic.c
index 6bf3288f5b..3c6a782b19 100644
--- a/src/backend/access/gin/ginlogic.c
+++ b/src/backend/access/gin/ginlogic.c
@@ -58,6 +58,7 @@ trueConsistentFn(GinScanKey key)
 	key->recheckCurItem = false;
 	return true;
 }
+
 static GinTernaryValue
 trueTriConsistentFn(GinScanKey key)
 {
diff --git a/src/backend/access/rmgrdesc/heapdesc.c b/src/backend/access/rmgrdesc/heapdesc.c
index 5c29fd9eae..1a5b8f7902 100644
--- a/src/backend/access/rmgrdesc/heapdesc.c
+++ b/src/backend/access/rmgrdesc/heapdesc.c
@@ -114,6 +114,7 @@ heap_desc(StringInfo buf, XLogReaderState *record)
 		appendStringInfo(buf, "off %u", xlrec->offnum);
 	}
 }
+
 void
 heap2_desc(StringInfo buf, XLogReaderState *record)
 {
diff --git a/src/backend/utils/mmgr/freepage.c b/src/backend/utils/mmgr/freepage.c
index e4ee1aab97..d253108d90 100644
--- a/src/backend/utils/mmgr/freepage.c
+++ b/src/backend/utils/mmgr/freepage.c
@@ -270,6 +270,7 @@ sum_free_pages_recurse(FreePageManager *fpm, FreePageBtree *btp, Size *sum)
 		}
 	}
 }
+
 static Size
 sum_free_pages(FreePageManager *fpm)
 {
-- 
2.17.0

0009-Wrong-function-name-in-header-comment.patchtext/x-diff; charset=us-asciiDownload
From 00f9370421c81b691a98dd3f0f3680dede6cf0e8 Mon Sep 17 00:00:00 2001
From: Justin Pryzby <pryzbyj@telsasoft.com>
Date: Sun, 5 Sep 2021 18:14:39 -0500
Subject: [PATCH 09/10] Wrong function name in header comment

Found like this

for f in `find src -type f -name '*.c'`; do awk -v p=0 '/^\/\* *-*$/{h=$0; getline; h=h"\n"$0; g=gensub( "[^_[:alnum:]].*", "", 1, $2); p=1} 0&&/^{/{p=0; print h}; /^ \*\/$/{h=h"\n"$0; getline a; h=h"\n"a; getline f; h=h"\n"f; l=length(g); if (substr(f,1,7) == substr(g,1,7) && substr(f,1,l) != substr(g,1,l)) print FILENAME,g,f,"\n"h; next} 0&&/^[^s/ {]/{p=0; h=""; next} 0&&p{h=h"\n"$0}' "$f"; done |less
---
 src/backend/executor/nodeTableFuncscan.c | 18 +++++++++---------
 src/backend/optimizer/util/pathnode.c    |  2 +-
 src/common/pg_lzcompress.c               |  2 +-
 3 files changed, 11 insertions(+), 11 deletions(-)

diff --git a/src/backend/executor/nodeTableFuncscan.c b/src/backend/executor/nodeTableFuncscan.c
index 27dfa1b956..f9fafa9e5b 100644
--- a/src/backend/executor/nodeTableFuncscan.c
+++ b/src/backend/executor/nodeTableFuncscan.c
@@ -14,11 +14,11 @@
  */
 /*
  * INTERFACE ROUTINES
- *		ExecTableFuncscan		scans a function.
+ *		ExecTableFuncScan		scans a function.
  *		ExecFunctionNext		retrieve next tuple in sequential order.
- *		ExecInitTableFuncscan	creates and initializes a TableFuncscan node.
- *		ExecEndTableFuncscan		releases any storage allocated.
- *		ExecReScanTableFuncscan rescans the function
+ *		ExecInitTableFuncScan	creates and initializes a TableFuncscan node.
+ *		ExecEndTableFuncScan		releases any storage allocated.
+ *		ExecReScanTableFuncScan rescans the function
  */
 #include "postgres.h"
 
@@ -46,7 +46,7 @@ static void tfuncLoadRows(TableFuncScanState *tstate, ExprContext *econtext);
 /* ----------------------------------------------------------------
  *		TableFuncNext
  *
- *		This is a workhorse for ExecTableFuncscan
+ *		This is a workhorse for ExecTableFuncScan
  * ----------------------------------------------------------------
  */
 static TupleTableSlot *
@@ -84,7 +84,7 @@ TableFuncRecheck(TableFuncScanState *node, TupleTableSlot *slot)
 }
 
 /* ----------------------------------------------------------------
- *		ExecTableFuncscan(node)
+ *		ExecTableFuncScan(node)
  *
  *		Scans the function sequentially and returns the next qualifying
  *		tuple.
@@ -103,7 +103,7 @@ ExecTableFuncScan(PlanState *pstate)
 }
 
 /* ----------------------------------------------------------------
- *		ExecInitTableFuncscan
+ *		ExecInitTableFuncScan
  * ----------------------------------------------------------------
  */
 TableFuncScanState *
@@ -205,7 +205,7 @@ ExecInitTableFuncScan(TableFuncScan *node, EState *estate, int eflags)
 }
 
 /* ----------------------------------------------------------------
- *		ExecEndTableFuncscan
+ *		ExecEndTableFuncScan
  *
  *		frees any storage allocated through C routines.
  * ----------------------------------------------------------------
@@ -234,7 +234,7 @@ ExecEndTableFuncScan(TableFuncScanState *node)
 }
 
 /* ----------------------------------------------------------------
- *		ExecReScanTableFuncscan
+ *		ExecReScanTableFuncScan
  *
  *		Rescans the relation.
  * ----------------------------------------------------------------
diff --git a/src/backend/optimizer/util/pathnode.c b/src/backend/optimizer/util/pathnode.c
index d7ff5d82cf..ebccd21155 100644
--- a/src/backend/optimizer/util/pathnode.c
+++ b/src/backend/optimizer/util/pathnode.c
@@ -105,7 +105,7 @@ compare_path_costs(Path *path1, Path *path2, CostSelector criterion)
 }
 
 /*
- * compare_path_fractional_costs
+ * compare_fractional_path_costs
  *	  Return -1, 0, or +1 according as path1 is cheaper, the same cost,
  *	  or more expensive than path2 for fetching the specified fraction
  *	  of the total tuples.
diff --git a/src/common/pg_lzcompress.c b/src/common/pg_lzcompress.c
index a30a2c2eb8..72e6a7ea61 100644
--- a/src/common/pg_lzcompress.c
+++ b/src/common/pg_lzcompress.c
@@ -825,7 +825,7 @@ pglz_decompress(const char *source, int32 slen, char *dest,
 
 
 /* ----------
- * pglz_max_compressed_size -
+ * pglz_maximum_compressed_size -
  *
  *		Calculate the maximum compressed size for a given amount of raw data.
  *		Return the maximum size, or total compressed size if maximum size is
-- 
2.17.0

0010-incorrect-file-names-in-header-comment.patchtext/x-diff; charset=us-asciiDownload
From 44d5df71acc2ca8b16362755647509b8c6b8c3cc Mon Sep 17 00:00:00 2001
From: Zhihong Yu <zyu@yugabyte.com>
Date: Fri, 10 Sep 2021 11:28:17 -0700
Subject: [PATCH 10/10] incorrect file names in header comment

awk by Justin, patch by Zhihong Yu

find src -name '*.[ch]' -type f -print0 |xargs -r0 awk '{fn=gensub(".*/", "", "1", FILENAME)} FILENAME~/scripts/{fn=gensub("\\.c","", 1, fn)} FNR==1 && /---$/{top=1} /\*\//{top=0} !top{next} FNR>1 && FNR<4 && NF==2 && $2!=fn{print FILENAME,"head",fn,$2} /IDENTIFICATION/{getline; if ($0!~FILENAME){print FILENAME,"foot",$2}}'
---
 src/backend/catalog/pg_publication.c            | 2 +-
 src/backend/commands/publicationcmds.c          | 2 +-
 src/backend/commands/subscriptioncmds.c         | 2 +-
 src/backend/optimizer/util/appendinfo.c         | 2 +-
 src/backend/optimizer/util/inherit.c            | 2 +-
 src/backend/replication/logical/logicalfuncs.c  | 2 +-
 src/backend/replication/logical/reorderbuffer.c | 2 +-
 src/backend/replication/logical/snapbuild.c     | 2 +-
 src/backend/utils/activity/backend_progress.c   | 4 ++--
 src/backend/utils/activity/backend_status.c     | 2 +-
 src/backend/utils/activity/wait_event.c         | 2 +-
 src/include/replication/pgoutput.h              | 2 +-
 src/include/utils/dynahash.h                    | 5 +++--
 src/port/pgcheckdir.c                           | 4 +++-
 14 files changed, 19 insertions(+), 16 deletions(-)

diff --git a/src/backend/catalog/pg_publication.c b/src/backend/catalog/pg_publication.c
index 9cd0c82f93..83432b476c 100644
--- a/src/backend/catalog/pg_publication.c
+++ b/src/backend/catalog/pg_publication.c
@@ -7,7 +7,7 @@
  * Portions Copyright (c) 1994, Regents of the University of California
  *
  * IDENTIFICATION
- *		pg_publication.c
+ *		src/backend/catalog/pg_publication.c
  *
  *-------------------------------------------------------------------------
  */
diff --git a/src/backend/commands/publicationcmds.c b/src/backend/commands/publicationcmds.c
index 9c7f91611d..4b99815ad6 100644
--- a/src/backend/commands/publicationcmds.c
+++ b/src/backend/commands/publicationcmds.c
@@ -7,7 +7,7 @@
  * Portions Copyright (c) 1994, Regents of the University of California
  *
  * IDENTIFICATION
- *		publicationcmds.c
+ *		src/backend/commands/publicationcmds.c
  *
  *-------------------------------------------------------------------------
  */
diff --git a/src/backend/commands/subscriptioncmds.c b/src/backend/commands/subscriptioncmds.c
index c47ba26369..ee700e456d 100644
--- a/src/backend/commands/subscriptioncmds.c
+++ b/src/backend/commands/subscriptioncmds.c
@@ -7,7 +7,7 @@
  * Portions Copyright (c) 1994, Regents of the University of California
  *
  * IDENTIFICATION
- *		subscriptioncmds.c
+ *		src/backend/commands/subscriptioncmds.c
  *
  *-------------------------------------------------------------------------
  */
diff --git a/src/backend/optimizer/util/appendinfo.c b/src/backend/optimizer/util/appendinfo.c
index af46f581ac..d696d9cbf9 100644
--- a/src/backend/optimizer/util/appendinfo.c
+++ b/src/backend/optimizer/util/appendinfo.c
@@ -8,7 +8,7 @@
  *
  *
  * IDENTIFICATION
- *	  src/backend/optimizer/path/appendinfo.c
+ *	  src/backend/optimizer/util/appendinfo.c
  *
  *-------------------------------------------------------------------------
  */
diff --git a/src/backend/optimizer/util/inherit.c b/src/backend/optimizer/util/inherit.c
index c758172efa..ff4250368d 100644
--- a/src/backend/optimizer/util/inherit.c
+++ b/src/backend/optimizer/util/inherit.c
@@ -8,7 +8,7 @@
  *
  *
  * IDENTIFICATION
- *	  src/backend/optimizer/path/inherit.c
+ *	  src/backend/optimizer/util/inherit.c
  *
  *-------------------------------------------------------------------------
  */
diff --git a/src/backend/replication/logical/logicalfuncs.c b/src/backend/replication/logical/logicalfuncs.c
index e59939aad1..5c4efb0dcf 100644
--- a/src/backend/replication/logical/logicalfuncs.c
+++ b/src/backend/replication/logical/logicalfuncs.c
@@ -9,7 +9,7 @@
  * Copyright (c) 2012-2021, PostgreSQL Global Development Group
  *
  * IDENTIFICATION
- *	  src/backend/replication/logicalfuncs.c
+ *	  src/backend/replication/logical/logicalfuncs.c
  *-------------------------------------------------------------------------
  */
 
diff --git a/src/backend/replication/logical/reorderbuffer.c b/src/backend/replication/logical/reorderbuffer.c
index 46e66608cf..3564b3bb82 100644
--- a/src/backend/replication/logical/reorderbuffer.c
+++ b/src/backend/replication/logical/reorderbuffer.c
@@ -8,7 +8,7 @@
  *
  *
  * IDENTIFICATION
- *	  src/backend/replication/reorderbuffer.c
+ *	  src/backend/replication/logical/reorderbuffer.c
  *
  * NOTES
  *	  This module gets handed individual pieces of transactions in the order
diff --git a/src/backend/replication/logical/snapbuild.c b/src/backend/replication/logical/snapbuild.c
index a14a3d6900..fb12791f39 100644
--- a/src/backend/replication/logical/snapbuild.c
+++ b/src/backend/replication/logical/snapbuild.c
@@ -110,7 +110,7 @@
  * Copyright (c) 2012-2021, PostgreSQL Global Development Group
  *
  * IDENTIFICATION
- *	  src/backend/replication/snapbuild.c
+ *	  src/backend/replication/logical/snapbuild.c
  *
  *-------------------------------------------------------------------------
  */
diff --git a/src/backend/utils/activity/backend_progress.c b/src/backend/utils/activity/backend_progress.c
index 6743e68cef..1d6c999415 100644
--- a/src/backend/utils/activity/backend_progress.c
+++ b/src/backend/utils/activity/backend_progress.c
@@ -1,11 +1,11 @@
 /* ----------
- * progress.c
+ * backend_progress.c
  *
  *	Command progress reporting infrastructure.
  *
  *	Copyright (c) 2001-2021, PostgreSQL Global Development Group
  *
- *	src/backend/postmaster/progress.c
+ *	src/backend/utils/activity/backend_progress.c
  * ----------
  */
 #include "postgres.h"
diff --git a/src/backend/utils/activity/backend_status.c b/src/backend/utils/activity/backend_status.c
index 7229598822..0aa3750c65 100644
--- a/src/backend/utils/activity/backend_status.c
+++ b/src/backend/utils/activity/backend_status.c
@@ -6,7 +6,7 @@
  *
  *
  * IDENTIFICATION
- *	  src/backend/postmaster/backend_status.c
+ *	  src/backend/utils/activity/backend_status.c
  * ----------
  */
 #include "postgres.h"
diff --git a/src/backend/utils/activity/wait_event.c b/src/backend/utils/activity/wait_event.c
index ef7e6bfb77..d0fd888f78 100644
--- a/src/backend/utils/activity/wait_event.c
+++ b/src/backend/utils/activity/wait_event.c
@@ -6,7 +6,7 @@
  *
  *
  * IDENTIFICATION
- *	  src/backend/postmaster/wait_event.c
+ *	  src/backend/utils/activity/wait_event.c
  *
  * NOTES
  *
diff --git a/src/include/replication/pgoutput.h b/src/include/replication/pgoutput.h
index 0dc460fb70..4bcea9b745 100644
--- a/src/include/replication/pgoutput.h
+++ b/src/include/replication/pgoutput.h
@@ -6,7 +6,7 @@
  * Copyright (c) 2015-2021, PostgreSQL Global Development Group
  *
  * IDENTIFICATION
- *		pgoutput.h
+ *		src/include/replication/pgoutput.h
  *
  *-------------------------------------------------------------------------
  */
diff --git a/src/include/utils/dynahash.h b/src/include/utils/dynahash.h
index 2f6adc2ef9..e5a52bc34c 100644
--- a/src/include/utils/dynahash.h
+++ b/src/include/utils/dynahash.h
@@ -1,13 +1,14 @@
 /*-------------------------------------------------------------------------
  *
- * dynahash
+ * dynahash.h
  *	  POSTGRES dynahash.h file definitions
  *
  *
  * Portions Copyright (c) 1996-2021, PostgreSQL Global Development Group
  * Portions Copyright (c) 1994, Regents of the University of California
  *
- * src/include/utils/dynahash.h
+ * IDENTIFICATION
+ *		src/include/utils/dynahash.h
  *
  *-------------------------------------------------------------------------
  */
diff --git a/src/port/pgcheckdir.c b/src/port/pgcheckdir.c
index 9fb2f23bdd..f19f33944c 100644
--- a/src/port/pgcheckdir.c
+++ b/src/port/pgcheckdir.c
@@ -1,6 +1,6 @@
 /*-------------------------------------------------------------------------
  *
- * src/port/pgcheckdir.c
+ * pgcheckdir.c
  *
  * A simple subroutine to check whether a directory exists and is empty or not.
  * Useful in both initdb and the backend.
@@ -8,6 +8,8 @@
  * Portions Copyright (c) 1996-2021, PostgreSQL Global Development Group
  * Portions Copyright (c) 1994, Regents of the University of California
  *
+ * IDENTIFICATION
+ *		src/port/pgcheckdir.c
  *-------------------------------------------------------------------------
  */
 
-- 
2.17.0

#2Justin Pryzby
pryzby@telsasoft.com
In reply to: Justin Pryzby (#1)
12 attachment(s)
Re: typos (and more)

On Fri, Sep 24, 2021 at 04:58:27PM -0500, Justin Pryzby wrote:

A compilation of fixes for master.

Thanks Michael for applying fixes to user-facing docs (I hadn't realized that
the 2nd one needed to be backpatched).

This fixes an file I failed to include in the "recheck" patch and more typos
for extended stats (+Tomas).

+Andres (Jit), +Zhihong (file header comments).

Attachments:

v2-0001-Avoid-double-parens.patchtext/x-diff; charset=us-asciiDownload
From b244c10676210b096e03a4170b5ce106fc470457 Mon Sep 17 00:00:00 2001
From: Justin Pryzby <pryzbyj@telsasoft.com>
Date: Wed, 28 Apr 2021 14:12:49 -0500
Subject: [PATCH v2 01/12] Avoid double parens

git grep -l '\<if (([^(]*))' '*.c'

First sent on this thread, which concludes with application of 0002 but not
this patch.

https://www.postgresql.org/message-id/flat/20210428182936.GE27406@telsasoft.com
---
 contrib/amcheck/verify_heapam.c          | 6 +++---
 contrib/ltree/ltree_io.c                 | 6 +++---
 src/backend/access/transam/xact.c        | 6 +++---
 src/backend/commands/tablecmds.c         | 2 +-
 src/backend/nodes/nodeFuncs.c            | 4 ++--
 src/backend/replication/logical/decode.c | 2 +-
 6 files changed, 13 insertions(+), 13 deletions(-)

diff --git a/contrib/amcheck/verify_heapam.c b/contrib/amcheck/verify_heapam.c
index 173f99d787..0ac52b6ba2 100644
--- a/contrib/amcheck/verify_heapam.c
+++ b/contrib/amcheck/verify_heapam.c
@@ -406,13 +406,13 @@ verify_heapam(PG_FUNCTION_ARGS)
 													   &vmbuffer);
 			if (skip_option == SKIP_PAGES_ALL_FROZEN)
 			{
-				if ((mapbits & VISIBILITYMAP_ALL_FROZEN) != 0)
+				if (mapbits & VISIBILITYMAP_ALL_FROZEN)
 					continue;
 			}
 
 			if (skip_option == SKIP_PAGES_ALL_VISIBLE)
 			{
-				if ((mapbits & VISIBILITYMAP_ALL_VISIBLE) != 0)
+				if (mapbits & VISIBILITYMAP_ALL_VISIBLE)
 					continue;
 			}
 		}
@@ -690,7 +690,7 @@ check_tuple_header(HeapCheckContext *ctx)
 			report_corruption(ctx,
 							  psprintf("tuple data should begin at byte %u, but actually begins at byte %u (1 attribute, has nulls)",
 									   expected_hoff, ctx->tuphdr->t_hoff));
-		else if ((infomask & HEAP_HASNULL))
+		else if (infomask & HEAP_HASNULL)
 			report_corruption(ctx,
 							  psprintf("tuple data should begin at byte %u, but actually begins at byte %u (%u attributes, has nulls)",
 									   expected_hoff, ctx->tuphdr->t_hoff, ctx->natts));
diff --git a/contrib/ltree/ltree_io.c b/contrib/ltree/ltree_io.c
index 15115cb29f..b75f35d5b5 100644
--- a/contrib/ltree/ltree_io.c
+++ b/contrib/ltree/ltree_io.c
@@ -661,17 +661,17 @@ deparse_lquery(const lquery *in)
 				}
 				memcpy(ptr, curtlevel->name, curtlevel->len);
 				ptr += curtlevel->len;
-				if ((curtlevel->flag & LVAR_SUBLEXEME))
+				if (curtlevel->flag & LVAR_SUBLEXEME)
 				{
 					*ptr = '%';
 					ptr++;
 				}
-				if ((curtlevel->flag & LVAR_INCASE))
+				if (curtlevel->flag & LVAR_INCASE)
 				{
 					*ptr = '@';
 					ptr++;
 				}
-				if ((curtlevel->flag & LVAR_ANYEND))
+				if (curtlevel->flag & LVAR_ANYEND)
 				{
 					*ptr = '*';
 					ptr++;
diff --git a/src/backend/access/transam/xact.c b/src/backend/access/transam/xact.c
index 6597ec45a9..8350a8fd19 100644
--- a/src/backend/access/transam/xact.c
+++ b/src/backend/access/transam/xact.c
@@ -2427,7 +2427,7 @@ PrepareTransaction(void)
 	 * cases, such as a temp table created and dropped all within the
 	 * transaction.  That seems to require much more bookkeeping though.
 	 */
-	if ((MyXactFlags & XACT_FLAGS_ACCESSEDTEMPNAMESPACE))
+	if (MyXactFlags & XACT_FLAGS_ACCESSEDTEMPNAMESPACE)
 		ereport(ERROR,
 				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
 				 errmsg("cannot PREPARE a transaction that has operated on temporary objects")));
@@ -5540,7 +5540,7 @@ XactLogCommitRecord(TimestampTz commit_time,
 		xl_xinfo.xinfo |= XACT_COMPLETION_UPDATE_RELCACHE_FILE;
 	if (forceSyncCommit)
 		xl_xinfo.xinfo |= XACT_COMPLETION_FORCE_SYNC_COMMIT;
-	if ((xactflags & XACT_FLAGS_ACQUIREDACCESSEXCLUSIVELOCK))
+	if (xactflags & XACT_FLAGS_ACQUIREDACCESSEXCLUSIVELOCK)
 		xl_xinfo.xinfo |= XACT_XINFO_HAS_AE_LOCKS;
 
 	/*
@@ -5691,7 +5691,7 @@ XactLogAbortRecord(TimestampTz abort_time,
 
 	xlrec.xact_time = abort_time;
 
-	if ((xactflags & XACT_FLAGS_ACQUIREDACCESSEXCLUSIVELOCK))
+	if (xactflags & XACT_FLAGS_ACQUIREDACCESSEXCLUSIVELOCK)
 		xl_xinfo.xinfo |= XACT_XINFO_HAS_AE_LOCKS;
 
 	if (nsubxacts > 0)
diff --git a/src/backend/commands/tablecmds.c b/src/backend/commands/tablecmds.c
index dbee6ae199..e018cdfd9e 100644
--- a/src/backend/commands/tablecmds.c
+++ b/src/backend/commands/tablecmds.c
@@ -16309,7 +16309,7 @@ PreCommit_on_commit_actions(void)
 				 * relations, we can skip truncating ON COMMIT DELETE ROWS
 				 * tables, as they must still be empty.
 				 */
-				if ((MyXactFlags & XACT_FLAGS_ACCESSEDTEMPNAMESPACE))
+				if (MyXactFlags & XACT_FLAGS_ACCESSEDTEMPNAMESPACE)
 					oids_to_truncate = lappend_oid(oids_to_truncate, oc->relid);
 				break;
 			case ONCOMMIT_DROP:
diff --git a/src/backend/nodes/nodeFuncs.c b/src/backend/nodes/nodeFuncs.c
index e276264882..e5e82cb85f 100644
--- a/src/backend/nodes/nodeFuncs.c
+++ b/src/backend/nodes/nodeFuncs.c
@@ -2390,7 +2390,7 @@ query_tree_walker(Query *query,
 	 * don't contain actual expressions. However they do contain OIDs which
 	 * may be needed by dependency walkers etc.
 	 */
-	if ((flags & QTW_EXAMINE_SORTGROUP))
+	if (flags & QTW_EXAMINE_SORTGROUP)
 	{
 		if (walker((Node *) query->groupClause, context))
 			return true;
@@ -3328,7 +3328,7 @@ query_tree_mutator(Query *query,
 	 * may be of interest to some mutators.
 	 */
 
-	if ((flags & QTW_EXAMINE_SORTGROUP))
+	if (flags & QTW_EXAMINE_SORTGROUP)
 	{
 		MUTATE(query->groupClause, query->groupClause, List *);
 		MUTATE(query->windowClause, query->windowClause, List *);
diff --git a/src/backend/replication/logical/decode.c b/src/backend/replication/logical/decode.c
index 2874dc0612..fc9a0d67c9 100644
--- a/src/backend/replication/logical/decode.c
+++ b/src/backend/replication/logical/decode.c
@@ -337,7 +337,7 @@ DecodeXactOp(LogicalDecodingContext *ctx, XLogRecordBuffer *buf)
 					ReorderBufferXidSetCatalogChanges(ctx->reorder, xid,
 													  buf->origptr);
 				}
-				else if ((!ctx->fast_forward))
+				else if (!ctx->fast_forward)
 					ReorderBufferImmediateInvalidation(ctx->reorder,
 													   invals->nmsgs,
 													   invals->msgs);
-- 
2.17.0

v2-0002-Deforming-is-never-done-for-Virtual-TTS-since-36d.patchtext/x-diff; charset=us-asciiDownload
From 168bc839d9218cfd93afdccc0c7be0b86a457539 Mon Sep 17 00:00:00 2001
From: Justin Pryzby <pryzbyj@telsasoft.com>
Date: Sat, 24 Apr 2021 17:02:52 -0500
Subject: [PATCH v2 02/12] Deforming is never done for Virtual TTS since
 36d22dd95bc87ca68e742da91f47f8826f8758c9

---
 src/backend/jit/llvm/llvmjit_deform.c | 4 +---
 1 file changed, 1 insertion(+), 3 deletions(-)

diff --git a/src/backend/jit/llvm/llvmjit_deform.c b/src/backend/jit/llvm/llvmjit_deform.c
index 008cd617f6..3221f28b8f 100644
--- a/src/backend/jit/llvm/llvmjit_deform.c
+++ b/src/backend/jit/llvm/llvmjit_deform.c
@@ -89,9 +89,7 @@ slot_compile_deform(LLVMJitContext *context, TupleDesc desc,
 
 	int			attnum;
 
-	/* virtual tuples never need deforming, so don't generate code */
-	if (ops == &TTSOpsVirtual)
-		return NULL;
+	Assert (ops != &TTSOpsVirtual);
 
 	/* decline to JIT for slot types we don't know to handle */
 	if (ops != &TTSOpsHeapTuple && ops != &TTSOpsBufferHeapTuple &&
-- 
2.17.0

v2-0003-tablefunc.c-Fix-comment.patchtext/x-diff; charset=us-asciiDownload
From f4e58fcfd250f65d19f0c771e45dda03597a998b Mon Sep 17 00:00:00 2001
From: Justin Pryzby <pryzbyj@telsasoft.com>
Date: Sat, 8 May 2021 08:12:46 -0500
Subject: [PATCH v2 03/12] tablefunc.c: Fix comment

Mentioned at: https://www.postgresql.org/message-id/CAJRYxuKmMkgHFKjuYPxThdT5Mjg%2Bg-nH5szYbS8UoVsQXzd95A%40mail.gmail.com
---
 contrib/tablefunc/tablefunc.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/contrib/tablefunc/tablefunc.c b/contrib/tablefunc/tablefunc.c
index 779bd4415e..52b272f298 100644
--- a/contrib/tablefunc/tablefunc.c
+++ b/contrib/tablefunc/tablefunc.c
@@ -1480,7 +1480,7 @@ validateConnectbyTupleDesc(TupleDesc td, bool show_branch, bool show_serial)
 						"fifth column must be type %s",
 						format_type_be(INT4OID))));
 
-	/* check that the type of the fifth column is INT4 */
+	/* check that the type of the fourth column is INT4 */
 	if (!show_branch && show_serial &&
 		TupleDescAttr(td, 3)->atttypid != INT4OID)
 		ereport(ERROR,
-- 
2.17.0

v2-0004-Recheck-arg-is-not-needed-since-2011.patchtext/x-diff; charset=us-asciiDownload
From dba3d80d1ccb71c5e98566e086632d5a12c45f6e Mon Sep 17 00:00:00 2001
From: Justin Pryzby <pryzbyj@telsasoft.com>
Date: Fri, 24 Sep 2021 14:18:52 -0500
Subject: [PATCH v2 04/12] Recheck arg is not needed since 2011

It was added at: a4dde3bff36dac1ac0b699becad6f103d861a874
And not used since: 7e2f906201c8bb95f7fb17e56b8740c38bda5441
---
 src/backend/commands/cluster.c   | 4 ++--
 src/backend/commands/tablecmds.c | 2 +-
 src/include/commands/cluster.h   | 2 +-
 3 files changed, 4 insertions(+), 4 deletions(-)

diff --git a/src/backend/commands/cluster.c b/src/backend/commands/cluster.c
index 9d22f648a8..ef9485c833 100644
--- a/src/backend/commands/cluster.c
+++ b/src/backend/commands/cluster.c
@@ -398,7 +398,7 @@ cluster_rel(Oid tableOid, Oid indexOid, ClusterParams *params)
 
 	/* Check heap and index are valid to cluster on */
 	if (OidIsValid(indexOid))
-		check_index_is_clusterable(OldHeap, indexOid, recheck, AccessExclusiveLock);
+		check_index_is_clusterable(OldHeap, indexOid, AccessExclusiveLock);
 
 	/*
 	 * Quietly ignore the request if this is a materialized view which has not
@@ -440,7 +440,7 @@ cluster_rel(Oid tableOid, Oid indexOid, ClusterParams *params)
  * protection here.
  */
 void
-check_index_is_clusterable(Relation OldHeap, Oid indexOid, bool recheck, LOCKMODE lockmode)
+check_index_is_clusterable(Relation OldHeap, Oid indexOid, LOCKMODE lockmode)
 {
 	Relation	OldIndex;
 
diff --git a/src/backend/commands/tablecmds.c b/src/backend/commands/tablecmds.c
index e018cdfd9e..9d2ab31e7e 100644
--- a/src/backend/commands/tablecmds.c
+++ b/src/backend/commands/tablecmds.c
@@ -13612,7 +13612,7 @@ ATExecClusterOn(Relation rel, const char *indexName, LOCKMODE lockmode)
 						indexName, RelationGetRelationName(rel))));
 
 	/* Check index is valid to cluster on */
-	check_index_is_clusterable(rel, indexOid, false, lockmode);
+	check_index_is_clusterable(rel, indexOid, lockmode);
 
 	/* And do the work */
 	mark_index_clustered(rel, indexOid, false);
diff --git a/src/include/commands/cluster.h b/src/include/commands/cluster.h
index b64d3bc204..bccbb9dd1c 100644
--- a/src/include/commands/cluster.h
+++ b/src/include/commands/cluster.h
@@ -32,7 +32,7 @@ typedef struct ClusterParams
 extern void cluster(ParseState *pstate, ClusterStmt *stmt, bool isTopLevel);
 extern void cluster_rel(Oid tableOid, Oid indexOid, ClusterParams *params);
 extern void check_index_is_clusterable(Relation OldHeap, Oid indexOid,
-									   bool recheck, LOCKMODE lockmode);
+									   LOCKMODE lockmode);
 extern void mark_index_clustered(Relation rel, Oid indexOid, bool is_internal);
 
 extern Oid	make_new_heap(Oid OIDOldHeap, Oid NewTableSpace, Oid NewAccessMethod,
-- 
2.17.0

v2-0005-Add-some-missing-newlines-after-function-definiti.patchtext/x-diff; charset=us-asciiDownload
From c231b8a0e2d3148dbfbba5cb7227b8a96359552f Mon Sep 17 00:00:00 2001
From: Justin Pryzby <pryzbyj@telsasoft.com>
Date: Mon, 5 Jul 2021 11:16:38 -0500
Subject: [PATCH v2 05/12] Add some missing newlines after function definitions

---
 src/backend/access/gin/ginlogic.c      | 1 +
 src/backend/access/rmgrdesc/heapdesc.c | 1 +
 src/backend/utils/mmgr/freepage.c      | 1 +
 3 files changed, 3 insertions(+)

diff --git a/src/backend/access/gin/ginlogic.c b/src/backend/access/gin/ginlogic.c
index 6bf3288f5b..3c6a782b19 100644
--- a/src/backend/access/gin/ginlogic.c
+++ b/src/backend/access/gin/ginlogic.c
@@ -58,6 +58,7 @@ trueConsistentFn(GinScanKey key)
 	key->recheckCurItem = false;
 	return true;
 }
+
 static GinTernaryValue
 trueTriConsistentFn(GinScanKey key)
 {
diff --git a/src/backend/access/rmgrdesc/heapdesc.c b/src/backend/access/rmgrdesc/heapdesc.c
index 5c29fd9eae..1a5b8f7902 100644
--- a/src/backend/access/rmgrdesc/heapdesc.c
+++ b/src/backend/access/rmgrdesc/heapdesc.c
@@ -114,6 +114,7 @@ heap_desc(StringInfo buf, XLogReaderState *record)
 		appendStringInfo(buf, "off %u", xlrec->offnum);
 	}
 }
+
 void
 heap2_desc(StringInfo buf, XLogReaderState *record)
 {
diff --git a/src/backend/utils/mmgr/freepage.c b/src/backend/utils/mmgr/freepage.c
index e4ee1aab97..d253108d90 100644
--- a/src/backend/utils/mmgr/freepage.c
+++ b/src/backend/utils/mmgr/freepage.c
@@ -270,6 +270,7 @@ sum_free_pages_recurse(FreePageManager *fpm, FreePageBtree *btp, Size *sum)
 		}
 	}
 }
+
 static Size
 sum_free_pages(FreePageManager *fpm)
 {
-- 
2.17.0

v2-0006-Wrong-function-name-in-header-comment.patchtext/x-diff; charset=us-asciiDownload
From fb264416b378342d3808e92eadd416203266a4f4 Mon Sep 17 00:00:00 2001
From: Justin Pryzby <pryzbyj@telsasoft.com>
Date: Sun, 5 Sep 2021 18:14:39 -0500
Subject: [PATCH v2 06/12] Wrong function name in header comment

Found like this

for f in `find src -type f -name '*.c'`; do awk -v p=0 '/^\/\* *-*$/{h=$0; getline; h=h"\n"$0; g=gensub( "[^_[:alnum:]].*", "", 1, $2); p=1} 0&&/^{/{p=0; print h}; /^ \*\/$/{h=h"\n"$0; getline a; h=h"\n"a; getline f; h=h"\n"f; l=length(g); if (substr(f,1,7) == substr(g,1,7) && substr(f,1,l) != substr(g,1,l)) print FILENAME,g,f,"\n"h; next} 0&&/^[^s/ {]/{p=0; h=""; next} 0&&p{h=h"\n"$0}' "$f"; done |less
---
 src/backend/executor/nodeTableFuncscan.c | 18 +++++++++---------
 src/backend/optimizer/util/pathnode.c    |  2 +-
 src/common/pg_lzcompress.c               |  2 +-
 3 files changed, 11 insertions(+), 11 deletions(-)

diff --git a/src/backend/executor/nodeTableFuncscan.c b/src/backend/executor/nodeTableFuncscan.c
index 27dfa1b956..f9fafa9e5b 100644
--- a/src/backend/executor/nodeTableFuncscan.c
+++ b/src/backend/executor/nodeTableFuncscan.c
@@ -14,11 +14,11 @@
  */
 /*
  * INTERFACE ROUTINES
- *		ExecTableFuncscan		scans a function.
+ *		ExecTableFuncScan		scans a function.
  *		ExecFunctionNext		retrieve next tuple in sequential order.
- *		ExecInitTableFuncscan	creates and initializes a TableFuncscan node.
- *		ExecEndTableFuncscan		releases any storage allocated.
- *		ExecReScanTableFuncscan rescans the function
+ *		ExecInitTableFuncScan	creates and initializes a TableFuncscan node.
+ *		ExecEndTableFuncScan		releases any storage allocated.
+ *		ExecReScanTableFuncScan rescans the function
  */
 #include "postgres.h"
 
@@ -46,7 +46,7 @@ static void tfuncLoadRows(TableFuncScanState *tstate, ExprContext *econtext);
 /* ----------------------------------------------------------------
  *		TableFuncNext
  *
- *		This is a workhorse for ExecTableFuncscan
+ *		This is a workhorse for ExecTableFuncScan
  * ----------------------------------------------------------------
  */
 static TupleTableSlot *
@@ -84,7 +84,7 @@ TableFuncRecheck(TableFuncScanState *node, TupleTableSlot *slot)
 }
 
 /* ----------------------------------------------------------------
- *		ExecTableFuncscan(node)
+ *		ExecTableFuncScan(node)
  *
  *		Scans the function sequentially and returns the next qualifying
  *		tuple.
@@ -103,7 +103,7 @@ ExecTableFuncScan(PlanState *pstate)
 }
 
 /* ----------------------------------------------------------------
- *		ExecInitTableFuncscan
+ *		ExecInitTableFuncScan
  * ----------------------------------------------------------------
  */
 TableFuncScanState *
@@ -205,7 +205,7 @@ ExecInitTableFuncScan(TableFuncScan *node, EState *estate, int eflags)
 }
 
 /* ----------------------------------------------------------------
- *		ExecEndTableFuncscan
+ *		ExecEndTableFuncScan
  *
  *		frees any storage allocated through C routines.
  * ----------------------------------------------------------------
@@ -234,7 +234,7 @@ ExecEndTableFuncScan(TableFuncScanState *node)
 }
 
 /* ----------------------------------------------------------------
- *		ExecReScanTableFuncscan
+ *		ExecReScanTableFuncScan
  *
  *		Rescans the relation.
  * ----------------------------------------------------------------
diff --git a/src/backend/optimizer/util/pathnode.c b/src/backend/optimizer/util/pathnode.c
index cedb3848dd..e53d381e19 100644
--- a/src/backend/optimizer/util/pathnode.c
+++ b/src/backend/optimizer/util/pathnode.c
@@ -105,7 +105,7 @@ compare_path_costs(Path *path1, Path *path2, CostSelector criterion)
 }
 
 /*
- * compare_path_fractional_costs
+ * compare_fractional_path_costs
  *	  Return -1, 0, or +1 according as path1 is cheaper, the same cost,
  *	  or more expensive than path2 for fetching the specified fraction
  *	  of the total tuples.
diff --git a/src/common/pg_lzcompress.c b/src/common/pg_lzcompress.c
index a30a2c2eb8..72e6a7ea61 100644
--- a/src/common/pg_lzcompress.c
+++ b/src/common/pg_lzcompress.c
@@ -825,7 +825,7 @@ pglz_decompress(const char *source, int32 slen, char *dest,
 
 
 /* ----------
- * pglz_max_compressed_size -
+ * pglz_maximum_compressed_size -
  *
  *		Calculate the maximum compressed size for a given amount of raw data.
  *		Return the maximum size, or total compressed size if maximum size is
-- 
2.17.0

v2-0007-incorrect-file-names-in-header-comment.patchtext/x-diff; charset=us-asciiDownload
From ca78971abf478beac96b3f8a5fd02427ab8c686c Mon Sep 17 00:00:00 2001
From: Zhihong Yu <zyu@yugabyte.com>
Date: Fri, 10 Sep 2021 11:28:17 -0700
Subject: [PATCH v2 07/12] incorrect file names in header comment

awk by Justin, patch by Zhihong Yu

find src -name '*.[ch]' -type f -print0 |xargs -r0 awk '{fn=gensub(".*/", "", "1", FILENAME)} FILENAME~/scripts/{fn=gensub("\\.c","", 1, fn)} FNR==1 && /---$/{top=1} /\*\//{top=0} !top{next} FNR>1 && FNR<4 && NF==2 && $2!=fn{print FILENAME,"head",fn,$2} /IDENTIFICATION/{getline; if ($0!~FILENAME){print FILENAME,"foot",$2}}'
---
 src/backend/catalog/pg_publication.c            | 2 +-
 src/backend/commands/publicationcmds.c          | 2 +-
 src/backend/commands/subscriptioncmds.c         | 2 +-
 src/backend/optimizer/util/appendinfo.c         | 2 +-
 src/backend/optimizer/util/inherit.c            | 2 +-
 src/backend/replication/logical/logicalfuncs.c  | 2 +-
 src/backend/replication/logical/reorderbuffer.c | 2 +-
 src/backend/replication/logical/snapbuild.c     | 2 +-
 src/backend/utils/activity/backend_progress.c   | 4 ++--
 src/backend/utils/activity/backend_status.c     | 2 +-
 src/backend/utils/activity/wait_event.c         | 2 +-
 src/include/replication/pgoutput.h              | 2 +-
 src/include/utils/dynahash.h                    | 5 +++--
 src/port/pgcheckdir.c                           | 4 +++-
 14 files changed, 19 insertions(+), 16 deletions(-)

diff --git a/src/backend/catalog/pg_publication.c b/src/backend/catalog/pg_publication.c
index 9cd0c82f93..83432b476c 100644
--- a/src/backend/catalog/pg_publication.c
+++ b/src/backend/catalog/pg_publication.c
@@ -7,7 +7,7 @@
  * Portions Copyright (c) 1994, Regents of the University of California
  *
  * IDENTIFICATION
- *		pg_publication.c
+ *		src/backend/catalog/pg_publication.c
  *
  *-------------------------------------------------------------------------
  */
diff --git a/src/backend/commands/publicationcmds.c b/src/backend/commands/publicationcmds.c
index 9c7f91611d..4b99815ad6 100644
--- a/src/backend/commands/publicationcmds.c
+++ b/src/backend/commands/publicationcmds.c
@@ -7,7 +7,7 @@
  * Portions Copyright (c) 1994, Regents of the University of California
  *
  * IDENTIFICATION
- *		publicationcmds.c
+ *		src/backend/commands/publicationcmds.c
  *
  *-------------------------------------------------------------------------
  */
diff --git a/src/backend/commands/subscriptioncmds.c b/src/backend/commands/subscriptioncmds.c
index c47ba26369..ee700e456d 100644
--- a/src/backend/commands/subscriptioncmds.c
+++ b/src/backend/commands/subscriptioncmds.c
@@ -7,7 +7,7 @@
  * Portions Copyright (c) 1994, Regents of the University of California
  *
  * IDENTIFICATION
- *		subscriptioncmds.c
+ *		src/backend/commands/subscriptioncmds.c
  *
  *-------------------------------------------------------------------------
  */
diff --git a/src/backend/optimizer/util/appendinfo.c b/src/backend/optimizer/util/appendinfo.c
index af46f581ac..d696d9cbf9 100644
--- a/src/backend/optimizer/util/appendinfo.c
+++ b/src/backend/optimizer/util/appendinfo.c
@@ -8,7 +8,7 @@
  *
  *
  * IDENTIFICATION
- *	  src/backend/optimizer/path/appendinfo.c
+ *	  src/backend/optimizer/util/appendinfo.c
  *
  *-------------------------------------------------------------------------
  */
diff --git a/src/backend/optimizer/util/inherit.c b/src/backend/optimizer/util/inherit.c
index c758172efa..ff4250368d 100644
--- a/src/backend/optimizer/util/inherit.c
+++ b/src/backend/optimizer/util/inherit.c
@@ -8,7 +8,7 @@
  *
  *
  * IDENTIFICATION
- *	  src/backend/optimizer/path/inherit.c
+ *	  src/backend/optimizer/util/inherit.c
  *
  *-------------------------------------------------------------------------
  */
diff --git a/src/backend/replication/logical/logicalfuncs.c b/src/backend/replication/logical/logicalfuncs.c
index e59939aad1..5c4efb0dcf 100644
--- a/src/backend/replication/logical/logicalfuncs.c
+++ b/src/backend/replication/logical/logicalfuncs.c
@@ -9,7 +9,7 @@
  * Copyright (c) 2012-2021, PostgreSQL Global Development Group
  *
  * IDENTIFICATION
- *	  src/backend/replication/logicalfuncs.c
+ *	  src/backend/replication/logical/logicalfuncs.c
  *-------------------------------------------------------------------------
  */
 
diff --git a/src/backend/replication/logical/reorderbuffer.c b/src/backend/replication/logical/reorderbuffer.c
index 46e66608cf..3564b3bb82 100644
--- a/src/backend/replication/logical/reorderbuffer.c
+++ b/src/backend/replication/logical/reorderbuffer.c
@@ -8,7 +8,7 @@
  *
  *
  * IDENTIFICATION
- *	  src/backend/replication/reorderbuffer.c
+ *	  src/backend/replication/logical/reorderbuffer.c
  *
  * NOTES
  *	  This module gets handed individual pieces of transactions in the order
diff --git a/src/backend/replication/logical/snapbuild.c b/src/backend/replication/logical/snapbuild.c
index a14a3d6900..fb12791f39 100644
--- a/src/backend/replication/logical/snapbuild.c
+++ b/src/backend/replication/logical/snapbuild.c
@@ -110,7 +110,7 @@
  * Copyright (c) 2012-2021, PostgreSQL Global Development Group
  *
  * IDENTIFICATION
- *	  src/backend/replication/snapbuild.c
+ *	  src/backend/replication/logical/snapbuild.c
  *
  *-------------------------------------------------------------------------
  */
diff --git a/src/backend/utils/activity/backend_progress.c b/src/backend/utils/activity/backend_progress.c
index 6743e68cef..1d6c999415 100644
--- a/src/backend/utils/activity/backend_progress.c
+++ b/src/backend/utils/activity/backend_progress.c
@@ -1,11 +1,11 @@
 /* ----------
- * progress.c
+ * backend_progress.c
  *
  *	Command progress reporting infrastructure.
  *
  *	Copyright (c) 2001-2021, PostgreSQL Global Development Group
  *
- *	src/backend/postmaster/progress.c
+ *	src/backend/utils/activity/backend_progress.c
  * ----------
  */
 #include "postgres.h"
diff --git a/src/backend/utils/activity/backend_status.c b/src/backend/utils/activity/backend_status.c
index 7229598822..0aa3750c65 100644
--- a/src/backend/utils/activity/backend_status.c
+++ b/src/backend/utils/activity/backend_status.c
@@ -6,7 +6,7 @@
  *
  *
  * IDENTIFICATION
- *	  src/backend/postmaster/backend_status.c
+ *	  src/backend/utils/activity/backend_status.c
  * ----------
  */
 #include "postgres.h"
diff --git a/src/backend/utils/activity/wait_event.c b/src/backend/utils/activity/wait_event.c
index ef7e6bfb77..d0fd888f78 100644
--- a/src/backend/utils/activity/wait_event.c
+++ b/src/backend/utils/activity/wait_event.c
@@ -6,7 +6,7 @@
  *
  *
  * IDENTIFICATION
- *	  src/backend/postmaster/wait_event.c
+ *	  src/backend/utils/activity/wait_event.c
  *
  * NOTES
  *
diff --git a/src/include/replication/pgoutput.h b/src/include/replication/pgoutput.h
index 0dc460fb70..4bcea9b745 100644
--- a/src/include/replication/pgoutput.h
+++ b/src/include/replication/pgoutput.h
@@ -6,7 +6,7 @@
  * Copyright (c) 2015-2021, PostgreSQL Global Development Group
  *
  * IDENTIFICATION
- *		pgoutput.h
+ *		src/include/replication/pgoutput.h
  *
  *-------------------------------------------------------------------------
  */
diff --git a/src/include/utils/dynahash.h b/src/include/utils/dynahash.h
index 2f6adc2ef9..e5a52bc34c 100644
--- a/src/include/utils/dynahash.h
+++ b/src/include/utils/dynahash.h
@@ -1,13 +1,14 @@
 /*-------------------------------------------------------------------------
  *
- * dynahash
+ * dynahash.h
  *	  POSTGRES dynahash.h file definitions
  *
  *
  * Portions Copyright (c) 1996-2021, PostgreSQL Global Development Group
  * Portions Copyright (c) 1994, Regents of the University of California
  *
- * src/include/utils/dynahash.h
+ * IDENTIFICATION
+ *		src/include/utils/dynahash.h
  *
  *-------------------------------------------------------------------------
  */
diff --git a/src/port/pgcheckdir.c b/src/port/pgcheckdir.c
index 9fb2f23bdd..f19f33944c 100644
--- a/src/port/pgcheckdir.c
+++ b/src/port/pgcheckdir.c
@@ -1,6 +1,6 @@
 /*-------------------------------------------------------------------------
  *
- * src/port/pgcheckdir.c
+ * pgcheckdir.c
  *
  * A simple subroutine to check whether a directory exists and is empty or not.
  * Useful in both initdb and the backend.
@@ -8,6 +8,8 @@
  * Portions Copyright (c) 1996-2021, PostgreSQL Global Development Group
  * Portions Copyright (c) 1994, Regents of the University of California
  *
+ * IDENTIFICATION
+ *		src/port/pgcheckdir.c
  *-------------------------------------------------------------------------
  */
 
-- 
2.17.0

v2-0008-Refer-to-plural-statistics-OBJECTS.patchtext/x-diff; charset=us-asciiDownload
From 6244a1816592c85dc9baed2e9cb33feba9c4342c Mon Sep 17 00:00:00 2001
From: Justin Pryzby <pryzbyj@telsasoft.com>
Date: Sun, 12 Sep 2021 23:45:05 -0500
Subject: [PATCH v2 08/12] Refer to plural statistics OBJECTS

See also: f04c9a61468904b6815b2bc73a48878817766e0e
---
 src/backend/commands/statscmds.c        |  4 ++--
 src/backend/statistics/extended_stats.c | 12 ++++++------
 src/backend/utils/adt/selfuncs.c        |  2 +-
 3 files changed, 9 insertions(+), 9 deletions(-)

diff --git a/src/backend/commands/statscmds.c b/src/backend/commands/statscmds.c
index afe6744e23..d6be3218ad 100644
--- a/src/backend/commands/statscmds.c
+++ b/src/backend/commands/statscmds.c
@@ -869,8 +869,8 @@ ChooseExtendedStatisticNameAddition(List *exprs)
 }
 
 /*
- * StatisticsGetRelation: given a statistics's relation OID, get the OID of
- * the relation it is an statistics on.  Uses the system cache.
+ * StatisticsGetRelation: given a statistics object's OID, get the OID of
+ * the relation it is defined on.  Uses the system cache.
  */
 Oid
 StatisticsGetRelation(Oid statId, bool missing_ok)
diff --git a/src/backend/statistics/extended_stats.c b/src/backend/statistics/extended_stats.c
index 5fa36e0036..d406a346c8 100644
--- a/src/backend/statistics/extended_stats.c
+++ b/src/backend/statistics/extended_stats.c
@@ -182,7 +182,7 @@ BuildRelationExtStatistics(Relation onerel, double totalrows,
 			continue;
 		}
 
-		/* compute statistics target for this statistics */
+		/* compute statistics target for this statistics object */
 		stattarget = statext_compute_stattarget(stat->stattarget,
 												bms_num_members(stat->columns),
 												stats);
@@ -195,7 +195,7 @@ BuildRelationExtStatistics(Relation onerel, double totalrows,
 		if (stattarget == 0)
 			continue;
 
-		/* evaluate expressions (if the statistics has any) */
+		/* evaluate expressions (if the statistics object has any) */
 		data = make_build_data(onerel, stat, numrows, rows, stats, stattarget);
 
 		/* compute statistic of each requested type */
@@ -257,7 +257,7 @@ BuildRelationExtStatistics(Relation onerel, double totalrows,
  * when analyzing only some of the columns, this will skip statistics objects
  * that would require additional columns.
  *
- * See statext_compute_stattarget for details about how we compute statistics
+ * See statext_compute_stattarget for details about how we compute the statistics
  * target for a statistics object (from the object target, attribute targets
  * and default statistics target).
  */
@@ -329,7 +329,7 @@ ComputeExtStatisticsRows(Relation onerel,
  *
  * When computing target for extended statistics objects, we consider three
  * places where the target may be set - the statistics object itself,
- * attributes the statistics is defined on, and then the default statistics
+ * attributes the statistics object is defined on, and then the default statistics
  * target.
  *
  * First we look at what's set for the statistics object itself, using the
@@ -1789,8 +1789,8 @@ statext_mcv_clauselist_selectivity(PlannerInfo *root, List *clauses, int varReli
 
 			/*
 			 * The clause was not estimated yet, and we've extracted either
-			 * attnums of expressions from it. Ignore it if it's not fully
-			 * covered by the chosen statistics.
+			 * attnums or expressions from it. Ignore it if it's not fully
+			 * covered by the chosen statistics object.
 			 *
 			 * We need to check both attributes and expressions, and reject if
 			 * either is not covered.
diff --git a/src/backend/utils/adt/selfuncs.c b/src/backend/utils/adt/selfuncs.c
index 0c8c05f6c2..65ab651eb5 100644
--- a/src/backend/utils/adt/selfuncs.c
+++ b/src/backend/utils/adt/selfuncs.c
@@ -3443,7 +3443,7 @@ estimate_num_groups(PlannerInfo *root, List *groupExprs, double input_rows,
 		 * expression, treat it as a single variable even if it's really more
 		 * complicated.
 		 *
-		 * XXX This has the consequence that if there's a statistics on the
+		 * XXX This has the consequence that if there's a statistics object on the
 		 * expression, we don't split it into individual Vars. This affects
 		 * our selection of statistics in estimate_multivariate_ndistinct,
 		 * because it's probably better to use more accurate estimate for each
-- 
2.17.0

v2-0009-examine_expression-fix-comment-wrong-since-bf2a69.patchtext/x-diff; charset=us-asciiDownload
From 5dd9d59249cc732310698723dd22ce71dd63879c Mon Sep 17 00:00:00 2001
From: Justin Pryzby <pryzbyj@telsasoft.com>
Date: Fri, 20 Aug 2021 19:40:52 -0500
Subject: [PATCH v2 09/12] examine_expression: fix comment wrong since
 bf2a691e02

---
 src/backend/statistics/extended_stats.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/src/backend/statistics/extended_stats.c b/src/backend/statistics/extended_stats.c
index d406a346c8..0a7d12d467 100644
--- a/src/backend/statistics/extended_stats.c
+++ b/src/backend/statistics/extended_stats.c
@@ -701,7 +701,7 @@ examine_expression(Node *expr, int stattarget)
 /*
  * Using 'vacatts' of size 'nvacatts' as input data, return a newly built
  * VacAttrStats array which includes only the items corresponding to
- * attributes indicated by 'stxkeys'. If we don't have all of the per column
+ * attributes indicated by 'attrs'. If we don't have all of the per column
  * stats available to compute the extended stats, then we return NULL to indicate
  * to the caller that the stats should not be built.
  */
-- 
2.17.0

v2-0010-statscmds.c-typos.patchtext/x-diff; charset=us-asciiDownload
From ad5acebbbc52f7fa6c2077120b5299a88cb4f102 Mon Sep 17 00:00:00 2001
From: Justin Pryzby <pryzby@telsasoft.com>
Date: Wed, 1 Sep 2021 14:38:16 -0500
Subject: [PATCH v2 10/12] statscmds.c typos

https://www.postgresql.org/message-id/flat/20210901193816.GO26465@telsasoft.com

There are some typos in 537ca68db (refenrece)
I'll add them to my typos branch if you don't want to patch them right now or
wait to see if someone notices anything else.
---
 src/backend/commands/statscmds.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/src/backend/commands/statscmds.c b/src/backend/commands/statscmds.c
index d6be3218ad..e9e2382ceb 100644
--- a/src/backend/commands/statscmds.c
+++ b/src/backend/commands/statscmds.c
@@ -213,11 +213,11 @@ CreateStatistics(CreateStatsStmt *stmt)
 	 * Convert the expression list to a simple array of attnums, but also keep
 	 * a list of more complex expressions.  While at it, enforce some
 	 * constraints - we don't allow extended statistics on system attributes,
-	 * and we require the data type to have less-than operator.
+	 * and we require the data type to have a less-than operator.
 	 *
-	 * There are many ways how to "mask" a simple attribute refenrece as an
+	 * There are many ways to "mask" a simple attribute reference as an
 	 * expression, for example "(a+0)" etc. We can't possibly detect all of
-	 * them, but we handle at least the simple case with attribute in parens.
+	 * them, but we handle at least the simple case with the attribute in parens.
 	 * There'll always be a way around this, if the user is determined (like
 	 * the "(a+0)" example), but this makes it somewhat consistent with how
 	 * indexes treat attributes/expressions.
-- 
2.17.0

v2-0011-f-stats-typos.patchtext/x-diff; charset=us-asciiDownload
From 5e24eb55f721cf8da442231b33a2e491ab2f126d Mon Sep 17 00:00:00 2001
From: Justin Pryzby <pryzbyj@telsasoft.com>
Date: Sun, 26 Sep 2021 11:13:27 -0500
Subject: [PATCH v2 11/12] f!stats typos

---
 src/backend/statistics/README     |  8 ++++----
 src/backend/statistics/README.mcv | 10 +++++-----
 2 files changed, 9 insertions(+), 9 deletions(-)

diff --git a/src/backend/statistics/README b/src/backend/statistics/README
index 7fda13e75b..765e3b3711 100644
--- a/src/backend/statistics/README
+++ b/src/backend/statistics/README
@@ -12,7 +12,7 @@ hopefully improving the estimates and producing better plans.
 Types of statistics
 -------------------
 
-There are currently two kinds of extended statistics:
+There are currently three kinds of extended statistics:
 
     (a) ndistinct coefficients
 
@@ -24,7 +24,7 @@ There are currently two kinds of extended statistics:
 Compatible clause types
 -----------------------
 
-Each type of statistics may be used to estimate some subset of clause types.
+Each type of statistic may be used to estimate some subset of clause types.
 
     (a) functional dependencies - equality clauses (AND), possibly IS NULL
 
@@ -73,8 +73,8 @@ it will do if:
 
 When the above conditions are met, clauselist_selectivity() first attempts to
 pass the clause list off to the extended statistics selectivity estimation
-function. This functions may not find any clauses which is can perform any
-estimations on. In such cases these clauses are simply ignored. When actual
+function. This function may not find any clauses which it can perform any
+estimations on. In such cases, these clauses are simply ignored. When actual
 estimation work is performed in these functions they're expected to mark which
 clauses they've performed estimations for so that any other function
 performing estimations knows which clauses are to be skipped.
diff --git a/src/backend/statistics/README.mcv b/src/backend/statistics/README.mcv
index 8455b0d13f..98a72ca1be 100644
--- a/src/backend/statistics/README.mcv
+++ b/src/backend/statistics/README.mcv
@@ -2,7 +2,7 @@ MCV lists
 =========
 
 Multivariate MCV (most-common values) lists are a straightforward extension of
-regular MCV list, tracking most frequent combinations of values for a group of
+regular MCV lists, tracking most frequent combinations of values for a group of
 attributes.
 
 This works particularly well for columns with a small number of distinct values,
@@ -18,7 +18,7 @@ Estimates of some clauses (e.g. equality) based on MCV lists are more accurate
 than when using histograms.
 
 Also, MCV lists don't necessarily require sorting of the values (the fact that
-we use sorting when building them is implementation detail), but even more
+we use sorting when building them is an implementation detail), but even more
 importantly the ordering is not built into the approximation (while histograms
 are built on ordering). So MCV lists work well even for attributes where the
 ordering of the data type is disconnected from the meaning of the data. For
@@ -53,7 +53,7 @@ Hashed MCV (not yet implemented)
 Regular MCV lists have to include actual values for each item, so if those items
 are large the list may be quite large. This is especially true for multivariate
 MCV lists, although the current implementation partially mitigates this by
-performing de-duplicating the values before storing them on disk.
+de-duplicating the values before storing them on disk.
 
 It's possible to only store hashes (32-bit values) instead of the actual values,
 significantly reducing the space requirements. Obviously, this would only make
@@ -77,14 +77,14 @@ to select the columns from pg_stats. The data is encoded as anyarrays, and
 all the items have the same data type, so anyarray provides a simple way to
 get a text representation.
 
-With multivariate MCV lists the columns may use different data types, making
+With multivariate MCV lists, the columns may use different data types, making
 it impossible to use anyarrays. It might be possible to produce a similar
 array-like representation, but that would complicate further processing and
 analysis of the MCV list.
 
 So instead the MCV lists are stored in a custom data type (pg_mcv_list),
 which however makes it more difficult to inspect the contents. To make that
-easier, there's a SRF returning detailed information about the MCV lists.
+easier, there's an SRF returning detailed information about the MCV lists.
 
     SELECT m.* FROM pg_statistic_ext s,
                     pg_statistic_ext_data d,
-- 
2.17.0

v2-0012-fix-ext-stats-exprs-references-to-indexes.patchtext/x-diff; charset=us-asciiDownload
From d8f629c51f70f936fead1d7a6d1b6d485e0f8a35 Mon Sep 17 00:00:00 2001
From: Justin Pryzby <pryzbyj@telsasoft.com>
Date: Sat, 25 Sep 2021 18:40:23 -0500
Subject: [PATCH v2 12/12] fix ext stats exprs references to indexes

Expressions on statistics were based on expressional indexes, but a few places
were copied and pasted without since being cleaned up.

Since a4d75c86bf15220df22de0a92c819ecef9db3849

Backpatch to v14?
---
 src/backend/commands/tablecmds.c   | 4 ++--
 src/backend/parser/parse_utilcmd.c | 2 +-
 src/backend/utils/adt/selfuncs.c   | 2 +-
 3 files changed, 4 insertions(+), 4 deletions(-)

diff --git a/src/backend/commands/tablecmds.c b/src/backend/commands/tablecmds.c
index 9d2ab31e7e..99f77c36bf 100644
--- a/src/backend/commands/tablecmds.c
+++ b/src/backend/commands/tablecmds.c
@@ -12585,13 +12585,13 @@ RememberStatisticsForRebuilding(Oid stxoid, AlteredTableInfo *tab)
 	/*
 	 * This de-duplication check is critical for two independent reasons: we
 	 * mustn't try to recreate the same statistics object twice, and if the
-	 * statistics depends on more than one column whose type is to be altered,
+	 * statistics object depends on more than one column whose type is to be altered,
 	 * we must capture its definition string before applying any of the type
 	 * changes. ruleutils.c will get confused if we ask again later.
 	 */
 	if (!list_member_oid(tab->changedStatisticsOids, stxoid))
 	{
-		/* OK, capture the index's existing definition string */
+		/* OK, capture the statistic object's existing definition string */
 		char	   *defstring = pg_get_statisticsobjdef_string(stxoid);
 
 		tab->changedStatisticsOids = lappend_oid(tab->changedStatisticsOids,
diff --git a/src/backend/parser/parse_utilcmd.c b/src/backend/parser/parse_utilcmd.c
index 1d3ee53244..49f617d2fd 100644
--- a/src/backend/parser/parse_utilcmd.c
+++ b/src/backend/parser/parse_utilcmd.c
@@ -2948,7 +2948,7 @@ transformStatsStmt(Oid relid, CreateStatsStmt *stmt, const char *queryString)
 	if (list_length(pstate->p_rtable) != 1)
 		ereport(ERROR,
 				(errcode(ERRCODE_INVALID_COLUMN_REFERENCE),
-				 errmsg("statistics expressions can refer only to the table being indexed")));
+				 errmsg("statistics expressions can refer only to the table being referenced")));
 
 	free_parsestate(pstate);
 
diff --git a/src/backend/utils/adt/selfuncs.c b/src/backend/utils/adt/selfuncs.c
index 65ab651eb5..abcb628a39 100644
--- a/src/backend/utils/adt/selfuncs.c
+++ b/src/backend/utils/adt/selfuncs.c
@@ -5252,7 +5252,7 @@ examine_variable(PlannerInfo *root, Node *node, int varRelid,
 				{
 					HeapTuple	t = statext_expressions_load(info->statOid, pos);
 
-					/* Get index's table for permission check */
+					/* Get statistic object's table for permission check */
 					RangeTblEntry *rte;
 					Oid			userid;
 
-- 
2.17.0

#3Michael Paquier
michael@paquier.xyz
In reply to: Justin Pryzby (#2)
Re: typos (and more)

On Sun, Sep 26, 2021 at 12:01:17PM -0500, Justin Pryzby wrote:

Thanks Michael for applying fixes to user-facing docs (I hadn't realized that
the 2nd one needed to be backpatched).

Yes, thanks for compiling all these. The two changes committed were
the only user-visible changes, which is why I have hastened this part
to include those fixes. The rest could just go on HEAD.
--
Michael

#4Michael Paquier
michael@paquier.xyz
In reply to: Michael Paquier (#3)
Re: typos (and more)

On Mon, Sep 27, 2021 at 09:24:27AM +0900, Michael Paquier wrote:

Yes, thanks for compiling all these. The two changes committed were
the only user-visible changes, which is why I have hastened this part
to include those fixes. The rest could just go on HEAD.

I have looked at the full set, and applied 0003, 0006, 0009, 0010 and
0011. 0001 has been discussed separately, and I am really not sure if
that's worth bothering. 0002 may actually break some code? I have
let 0004 and 0005 alone. 0007 could be related to the discussion
where we could just remove all those IDENTIFICATION fields. The use
of "statistic", "statistics" and "statistics object" in 0008 and 0012
is indeed inconsistent. The latter term is the most used, but it
sounds a bit weird to me even if it refers to the DDL object
manipulated. Simply using "statistics" would be tempting.
--
Michael

#5Alvaro Herrera
alvherre@alvh.no-ip.org
In reply to: Michael Paquier (#4)
Re: typos (and more)

On 2021-Sep-27, Michael Paquier wrote:

The use
of "statistic", "statistics" and "statistics object" in 0008 and 0012
is indeed inconsistent. The latter term is the most used, but it
sounds a bit weird to me even if it refers to the DDL object
manipulated. Simply using "statistics" would be tempting.

Initially we just used "statistic" as a noun, which IIRC was already
grammatically wrong (but I didn't know that and I think Tomas didn't
either); later at some point when discussing how to use that noun in
plural we realized this and argued that merely using "statistics" was
even more wrong. It was then that we started using the term "statistics
object" with plural "statistics objects". Going back to using just
"statistics" is unlikely to have become correct; I think Justin's
patches 0008 and 0012 are correct.

--
Álvaro Herrera 39°49'30"S 73°17'W — https://www.EnterpriseDB.com/
"La libertad es como el dinero; el que no la sabe emplear la pierde" (Alvarez)

#6Michael Paquier
michael@paquier.xyz
In reply to: Alvaro Herrera (#5)
Re: typos (and more)

On Mon, Sep 27, 2021 at 06:04:02PM -0300, Alvaro Herrera wrote:

Initially we just used "statistic" as a noun, which IIRC was already
grammatically wrong (but I didn't know that and I think Tomas didn't
either); later at some point when discussing how to use that noun in
plural we realized this and argued that merely using "statistics" was
even more wrong. It was then that we started using the term "statistics
object" with plural "statistics objects". Going back to using just
"statistics" is unlikely to have become correct; I think Justin's
patches 0008 and 0012 are correct.

Thanks for confirming.

     if (list_length(pstate->p_rtable) != 1)
         ereport(ERROR,
                 (errcode(ERRCODE_INVALID_COLUMN_REFERENCE),
-                 errmsg("statistics expressions can refer only to the table being indexed")));
+                 errmsg("statistics expressions can refer only to the table being referenced")));
This part should be backpatched?  The code claims that this should
be dead code so an elog() would be more adapted, and the same can be
said about transformRuleStmt() and transformIndexStmt(), no?  That
would be less messages to translate. 
--
Michael
#7Justin Pryzby
pryzby@telsasoft.com
In reply to: Alvaro Herrera (#5)
1 attachment(s)
Re: typos (and more)

On Mon, Sep 27, 2021 at 06:04:02PM -0300, Alvaro Herrera wrote:

On 2021-Sep-27, Michael Paquier wrote:

The use
of "statistic", "statistics" and "statistics object" in 0008 and 0012
is indeed inconsistent. The latter term is the most used, but it
sounds a bit weird to me even if it refers to the DDL object
manipulated. Simply using "statistics" would be tempting.

Initially we just used "statistic" as a noun, which IIRC was already
grammatically wrong (but I didn't know that and I think Tomas didn't
either); later at some point when discussing how to use that noun in
plural we realized this and argued that merely using "statistics" was
even more wrong. It was then that we started using the term "statistics
object" with plural "statistics objects". Going back to using just
"statistics" is unlikely to have become correct; I think Justin's
patches 0008 and 0012 are correct.

Attached is an updated patch fixing more of the same.

--
Justin

Attachments:

0001-Refer-to-plural-statistics-OBJECTS.patchtext/x-diff; charset=us-asciiDownload
From 45c16e1cb6b3ddf007806f5942f3acf64a75edf7 Mon Sep 17 00:00:00 2001
From: Justin Pryzby <pryzbyj@telsasoft.com>
Date: Sun, 12 Sep 2021 23:45:05 -0500
Subject: [PATCH] Refer to plural statistics OBJECTS

See also: f04c9a61468904b6815b2bc73a48878817766e0e
---
 src/backend/commands/statscmds.c        | 14 +++++++-------
 src/backend/statistics/extended_stats.c | 12 ++++++------
 src/backend/utils/adt/selfuncs.c        | 12 ++++++------
 3 files changed, 19 insertions(+), 19 deletions(-)

diff --git a/src/backend/commands/statscmds.c b/src/backend/commands/statscmds.c
index 9938b65083..13987d9dcb 100644
--- a/src/backend/commands/statscmds.c
+++ b/src/backend/commands/statscmds.c
@@ -431,7 +431,7 @@ CreateStatistics(CreateStatsStmt *stmt)
 	 * similar to why we don't bother with extracting columns from
 	 * expressions. It's either expensive or very easy to defeat for
 	 * determined user, and there's no risk if we allow such statistics (the
-	 * statistics is useless, but harmless).
+	 * statistic is useless, but harmless).
 	 */
 	foreach(cell, stxexprs)
 	{
@@ -560,7 +560,7 @@ CreateStatistics(CreateStatsStmt *stmt)
 	}
 
 	/*
-	 * If there are no dependencies on a column, give the statistics an auto
+	 * If there are no dependencies on a column, give the statistics object an auto
 	 * dependency on the whole table.  In most cases, this will be redundant,
 	 * but it might not be if the statistics expressions contain no Vars
 	 * (which might seem strange but possible). This is consistent with what
@@ -649,7 +649,7 @@ AlterStatistics(AlterStatsStmt *stmt)
 	stxoid = get_statistics_object_oid(stmt->defnames, stmt->missing_ok);
 
 	/*
-	 * If we got here and the OID is not valid, it means the statistics does
+	 * If we got here and the OID is not valid, it means the statistics object does
 	 * not exist, but the command specified IF EXISTS. So report this as a
 	 * simple NOTICE and we're done.
 	 */
@@ -768,7 +768,7 @@ RemoveStatisticsById(Oid statsOid)
 }
 
 /*
- * Select a nonconflicting name for a new statistics.
+ * Select a nonconflicting name for a new statistics object.
  *
  * name1, name2, and label are used the same way as for makeObjectName(),
  * except that the label can't be NULL; digits will be appended to the label
@@ -815,7 +815,7 @@ ChooseExtendedStatisticName(const char *name1, const char *name2,
 }
 
 /*
- * Generate "name2" for a new statistics given the list of column names for it
+ * Generate "name2" for a new statistics object given the list of column names for it
  * This will be passed to ChooseExtendedStatisticName along with the parent
  * table name and a suitable label.
  *
@@ -869,8 +869,8 @@ ChooseExtendedStatisticNameAddition(List *exprs)
 }
 
 /*
- * StatisticsGetRelation: given a statistics's relation OID, get the OID of
- * the relation it is an statistics on.  Uses the system cache.
+ * StatisticsGetRelation: given a statistics object's OID, get the OID of
+ * the relation it is defined on.  Uses the system cache.
  */
 Oid
 StatisticsGetRelation(Oid statId, bool missing_ok)
diff --git a/src/backend/statistics/extended_stats.c b/src/backend/statistics/extended_stats.c
index 4c35223457..97f4ba3590 100644
--- a/src/backend/statistics/extended_stats.c
+++ b/src/backend/statistics/extended_stats.c
@@ -182,7 +182,7 @@ BuildRelationExtStatistics(Relation onerel, double totalrows,
 			continue;
 		}
 
-		/* compute statistics target for this statistics */
+		/* compute statistics target for this statistics object */
 		stattarget = statext_compute_stattarget(stat->stattarget,
 												bms_num_members(stat->columns),
 												stats);
@@ -195,7 +195,7 @@ BuildRelationExtStatistics(Relation onerel, double totalrows,
 		if (stattarget == 0)
 			continue;
 
-		/* evaluate expressions (if the statistics has any) */
+		/* evaluate expressions (if the statistics object has any) */
 		data = make_build_data(onerel, stat, numrows, rows, stats, stattarget);
 
 		/* compute statistic of each requested type */
@@ -257,7 +257,7 @@ BuildRelationExtStatistics(Relation onerel, double totalrows,
  * when analyzing only some of the columns, this will skip statistics objects
  * that would require additional columns.
  *
- * See statext_compute_stattarget for details about how we compute statistics
+ * See statext_compute_stattarget for details about how we compute the statistics
  * target for a statistics object (from the object target, attribute targets
  * and default statistics target).
  */
@@ -329,7 +329,7 @@ ComputeExtStatisticsRows(Relation onerel,
  *
  * When computing target for extended statistics objects, we consider three
  * places where the target may be set - the statistics object itself,
- * attributes the statistics is defined on, and then the default statistics
+ * attributes the statistics object is defined on, and then the default statistics
  * target.
  *
  * First we look at what's set for the statistics object itself, using the
@@ -1789,8 +1789,8 @@ statext_mcv_clauselist_selectivity(PlannerInfo *root, List *clauses, int varReli
 
 			/*
 			 * The clause was not estimated yet, and we've extracted either
-			 * attnums of expressions from it. Ignore it if it's not fully
-			 * covered by the chosen statistics.
+			 * attnums or expressions from it. Ignore it if it's not fully
+			 * covered by the chosen statistics object.
 			 *
 			 * We need to check both attributes and expressions, and reject if
 			 * either is not covered.
diff --git a/src/backend/utils/adt/selfuncs.c b/src/backend/utils/adt/selfuncs.c
index 0c8c05f6c2..0e5fb83505 100644
--- a/src/backend/utils/adt/selfuncs.c
+++ b/src/backend/utils/adt/selfuncs.c
@@ -3443,7 +3443,7 @@ estimate_num_groups(PlannerInfo *root, List *groupExprs, double input_rows,
 		 * expression, treat it as a single variable even if it's really more
 		 * complicated.
 		 *
-		 * XXX This has the consequence that if there's a statistics on the
+		 * XXX This has the consequence that if there's a statistics object on the
 		 * expression, we don't split it into individual Vars. This affects
 		 * our selection of statistics in estimate_multivariate_ndistinct,
 		 * because it's probably better to use more accurate estimate for each
@@ -3918,7 +3918,7 @@ estimate_multivariate_ndistinct(PlannerInfo *root, RelOptInfo *rel,
 	if (!rel->statlist)
 		return false;
 
-	/* look for the ndistinct statistics matching the most vars */
+	/* look for the ndistinct statistics object matching the most vars */
 	nmatches_vars = 0;			/* we require at least two matches */
 	nmatches_exprs = 0;
 	foreach(lc, rel->statlist)
@@ -3964,7 +3964,7 @@ estimate_multivariate_ndistinct(PlannerInfo *root, RelOptInfo *rel,
 				continue;
 			}
 
-			/* expression - see if it's in the statistics */
+			/* expression - see if it's in the statistics object */
 			foreach(lc3, info->exprs)
 			{
 				Node	   *expr = (Node *) lfirst(lc3);
@@ -4053,7 +4053,7 @@ estimate_multivariate_ndistinct(PlannerInfo *root, RelOptInfo *rel,
 				if (!AttrNumberIsForUserDefinedAttr(attnum))
 					continue;
 
-				/* Is the variable covered by the statistics? */
+				/* Is the variable covered by the statistics object? */
 				if (!bms_is_member(attnum, matched_info->keys))
 					continue;
 
@@ -4075,7 +4075,7 @@ estimate_multivariate_ndistinct(PlannerInfo *root, RelOptInfo *rel,
 			if (found)
 				continue;
 
-			/* expression - see if it's in the statistics */
+			/* expression - see if it's in the statistics object */
 			idx = 0;
 			foreach(lc3, matched_info->exprs)
 			{
@@ -5276,7 +5276,7 @@ examine_variable(PlannerInfo *root, Node *node, int varRelid,
 					/*
 					 * For simplicity, we insist on the whole table being
 					 * selectable, rather than trying to identify which
-					 * column(s) the statistics depends on.  Also require all
+					 * column(s) the statistics object depends on.  Also require all
 					 * rows to be selectable --- there must be no
 					 * securityQuals from security barrier views or RLS
 					 * policies.
-- 
2.17.0

#8Michael Paquier
michael@paquier.xyz
In reply to: Justin Pryzby (#7)
Re: typos (and more)

On Mon, Sep 27, 2021 at 07:50:02PM -0500, Justin Pryzby wrote:

Attached is an updated patch fixing more of the same.

Does this include everything you have spotted, as well as everything
from the previous patches 0008 and 0012 posted?
--
Michael

#9Justin Pryzby
pryzby@telsasoft.com
In reply to: Michael Paquier (#8)
Re: typos (and more)

On Tue, Sep 28, 2021 at 11:15:39AM +0900, Michael Paquier wrote:

On Mon, Sep 27, 2021 at 07:50:02PM -0500, Justin Pryzby wrote:

Attached is an updated patch fixing more of the same.

Does this include everything you have spotted, as well as everything
from the previous patches 0008 and 0012 posted?

That's an "expanded" version of 0008.

It doesn't include 0012, which is primarily about fixing incorrect references
to "index expressions" that should refer to stats expressions. Naturally 0012
also uses the phrase "statistics objects", and fixes one nearby reference
that's not itself about indexes, which could arguably be in 0008 instead..

--
Justin

#10Michael Paquier
michael@paquier.xyz
In reply to: Justin Pryzby (#9)
Re: typos (and more)

On Mon, Sep 27, 2021 at 09:27:56PM -0500, Justin Pryzby wrote:

That's an "expanded" version of 0008.

Okay, thanks.

It doesn't include 0012, which is primarily about fixing incorrect references
to "index expressions" that should refer to stats expressions. Naturally 0012
also uses the phrase "statistics objects", and fixes one nearby reference
that's not itself about indexes, which could arguably be in 0008 instead..

Merging both made the most sense to me after reviewing the whole area
of the code dedicated to stats. This has been applied after taking
care of some issues with the indentation, with few extra tweaks.
--
Michael