I find that the check in addRangeTableEntryForValues is dead code, because both callers pass a NULL Alias. I find no way to give VALUES an alias directly. This has annoyed me in the past (not a big deal tbh), but that makes me refrain from suggesting to removing the code.
I have the same finding. For SelectStmt, the VALUES clause always
appears inside RangeSubselect, and you can give alias only to the subquery, not the VALUES clause. For InsertStmt, seems you cannot specify an alias for the VALUES clause.
Since the only two callers to addRangeTableEntryForValues both pass NULL as Alias, I think we can remove the related codes inside that function.