Adjust comments for `IndexOptInfo` to accurately reflect indexcollations's length
Hi,
Length of indexcollations[] in `IndexOptInfo` is nkeycolumns, but
struct comments fail to express this, it says:
indexkeys[], indexcollations[] each have ncolumns entries.
So we should polish this description. trivial patch attached.
--
Regards
Junwang Zhao
Attachments:
0001-indexcollations-length-should-be-nkeycolumns.patchapplication/octet-stream; name=0001-indexcollations-length-should-be-nkeycolumns.patchDownload
From bbff99cd2a1718178201667347401faa294cb1e1 Mon Sep 17 00:00:00 2001
From: Junwang Zhao <zhjwpku@gmail.com>
Date: Sat, 22 Nov 2025 20:36:19 +0800
Subject: [PATCH] indexcollations length should be nkeycolumns
---
src/include/nodes/pathnodes.h | 7 ++++---
1 file changed, 4 insertions(+), 3 deletions(-)
diff --git a/src/include/nodes/pathnodes.h b/src/include/nodes/pathnodes.h
index 30d889b54c5..addafe3dcd7 100644
--- a/src/include/nodes/pathnodes.h
+++ b/src/include/nodes/pathnodes.h
@@ -1216,9 +1216,10 @@ typedef struct RelAggInfo
* IndexOptInfo
* Per-index information for planning/optimization
*
- * indexkeys[], indexcollations[] each have ncolumns entries.
- * opfamily[], and opcintype[] each have nkeycolumns entries. They do
- * not contain any information about included attributes.
+ * indexkeys[] has ncolumns entries.
+ *
+ * indexcollations[], opfamily[], and opcintype[] each have nkeycolumns
+ * entries. They do not contain any information about included attributes.
*
* sortopfamily[], reverse_sort[], and nulls_first[] have
* nkeycolumns entries, if the index is ordered; but if it is unordered,
--
2.41.0
On Sun, 23 Nov 2025 at 01:44, Junwang Zhao <zhjwpku@gmail.com> wrote:
Length of indexcollations[] in `IndexOptInfo` is nkeycolumns, but
struct comments fail to express this, it says:indexkeys[], indexcollations[] each have ncolumns entries.
So we should polish this description. trivial patch attached.
Thanks. I agree with the patch. We should probably mention
canreturn[] too. I can take care of this.
David
On Mon, Nov 24, 2025 at 6:52 AM David Rowley <dgrowleyml@gmail.com> wrote:
On Sun, 23 Nov 2025 at 01:44, Junwang Zhao <zhjwpku@gmail.com> wrote:
Length of indexcollations[] in `IndexOptInfo` is nkeycolumns, but
struct comments fail to express this, it says:indexkeys[], indexcollations[] each have ncolumns entries.
So we should polish this description. trivial patch attached.
Thanks. I agree with the patch. We should probably mention
canreturn[] too. I can take care of this.
Agreed. Thanks for taking care of this.
David
--
Regards
Junwang Zhao
On Mon, 24 Nov 2025 at 14:57, Junwang Zhao <zhjwpku@gmail.com> wrote:
On Mon, Nov 24, 2025 at 6:52 AM David Rowley <dgrowleyml@gmail.com> wrote:
On Sun, 23 Nov 2025 at 01:44, Junwang Zhao <zhjwpku@gmail.com> wrote:
Thanks. I agree with the patch. We should probably mention
canreturn[] too. I can take care of this.Agreed. Thanks for taking care of this.
Pushed.
David