diff --git a/src/backend/utils/adt/ruleutils.c b/src/backend/utils/adt/ruleutils.c
index 653685bffc..aa38353185 100644
--- a/src/backend/utils/adt/ruleutils.c
+++ b/src/backend/utils/adt/ruleutils.c
@@ -4573,7 +4573,7 @@ set_join_column_names(deparse_namespace *dpns, RangeTblEntry *rte,
 		if (colname == NULL)
 		{
 			/* If user wrote an alias, prefer that over real column name */
-			if (rte->alias && i < list_length(rte->alias->colnames))
+			if (i < list_length(rte->alias->colnames))
 				colname = strVal(list_nth(rte->alias->colnames, i));
 			else
 				colname = real_colname;
