This is an automated email from the ASF dual-hosted git repository.
gfphoenix78 pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/cloudberry.git
The following commit(s) were added to refs/heads/main by this push:
new 744d2d42355 Fix incorrect column number in funcTupleDesc
initialization.
744d2d42355 is described below
commit 744d2d42355d437600a73bc2be1cf93d1b71ddf2
Author: zhangyue <[email protected]>
AuthorDate: Sat Aug 23 12:15:12 2025 +0800
Fix incorrect column number in funcTupleDesc initialization.
In process_sample_rows(), when initializing funcTupleDesc for table columns,
the column number should start from NUM_SAMPLE_FIXED_COLS + 1 (5) instead
of 4.
The first 4 columns (1-4) are reserved for fixed columns:
- Column 1: totalrows (FLOAT8OID)
- Column 2: totaldeadrows (FLOAT8OID)
- Column 3: oversized_cols_length (FLOAT8ARRAYOID)
- Column 4: NDV array (FLOAT8ARRAYOID)
Table columns should start from column 5, so the correct formula is:
(AttrNumber) NUM_SAMPLE_FIXED_COLS + 1 + index
This bug is harmless because funcTupleDesc's column type information is not
actually used in subsequent processing - only the column count (natts) is
used.
The actual type information is obtained dynamically via
lookup_rowtype_tupdesc().
However, it's still worth fixing for code correctness and maintainability.
---
src/backend/commands/analyze.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/src/backend/commands/analyze.c b/src/backend/commands/analyze.c
index 6f5c4c5c42c..21c863ff346 100644
--- a/src/backend/commands/analyze.c
+++ b/src/backend/commands/analyze.c
@@ -2758,7 +2758,7 @@ process_sample_rows(Portal portal,
if (!attr->attisdropped)
{
- TupleDescInitEntry(funcTupleDesc, (AttrNumber) 4 +
index, "",
+ TupleDescInitEntry(funcTupleDesc, (AttrNumber)
NUM_SAMPLE_FIXED_COLS + 1 + index, "",
typid,
attr->atttypmod, attr->attndims);
index++;
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]