Alias *eref;
int numaliases;
+ /*
+ * Fail if join has too many columns --- we must be able to reference
+ * any of the columns with an AttrNumber.
+ */
+ if (list_length(aliasvars) > MaxAttrNumber)
+ ereport(ERROR,
+ (errcode(ERRCODE_PROGRAM_LIMIT_EXCEEDED),
+ errmsg("joins can have at most %d columns",
+ MaxAttrNumber)));
+
rte->rtekind = RTE_JOIN;
rte->relid = InvalidOid;
rte->subquery = NULL;
varnode = makeVar(rtindex,
attnum,
atttypid,
- -1,
+ colDef->typename->typmod,
sublevels_up);
*colvars = lappend(*colvars, varnode);
ColumnDef *colDef = list_nth(coldeflist, attnum - 1);
*vartype = typenameTypeId(colDef->typename);
- *vartypmod = -1;
+ *vartypmod = colDef->typename->typmod;
}
else
{