Fix assertions in other PG versions too, the original fix is in PR-7379

release-10.2
Teja Mupparti 2024-01-23 10:24:45 -08:00 committed by Teja Mupparti
parent b3c0be9ed3
commit bcbb01114d
2 changed files with 18 additions and 4 deletions

View File

@ -1380,8 +1380,15 @@ set_join_column_names(deparse_namespace *dpns, RangeTblEntry *rte,
/* Assert we processed the right number of columns */ /* Assert we processed the right number of columns */
#ifdef USE_ASSERT_CHECKING #ifdef USE_ASSERT_CHECKING
while (i < colinfo->num_cols && colinfo->colnames[i] == NULL) for (int col_index = 0; col_index < colinfo->num_cols; col_index++)
{
/*
* In the above processing-loops, "i" advances only if
* the column is not new, check if this is a new column.
*/
if (colinfo->is_new_col[col_index])
i++; i++;
}
Assert(i == colinfo->num_cols); Assert(i == colinfo->num_cols);
Assert(j == nnewcolumns); Assert(j == nnewcolumns);
#endif #endif

View File

@ -1444,8 +1444,15 @@ set_join_column_names(deparse_namespace *dpns, RangeTblEntry *rte,
/* Assert we processed the right number of columns */ /* Assert we processed the right number of columns */
#ifdef USE_ASSERT_CHECKING #ifdef USE_ASSERT_CHECKING
while (i < colinfo->num_cols && colinfo->colnames[i] == NULL) for (int col_index = 0; col_index < colinfo->num_cols; col_index++)
{
/*
* In the above processing-loops, "i" advances only if
* the column is not new, check if this is a new column.
*/
if (colinfo->is_new_col[col_index])
i++; i++;
}
Assert(i == colinfo->num_cols); Assert(i == colinfo->num_cols);
Assert(j == nnewcolumns); Assert(j == nnewcolumns);
#endif #endif