diff options
Diffstat (limited to 'src/backend/parser/parse_relation.c')
-rw-r--r-- | src/backend/parser/parse_relation.c | 12 |
1 files changed, 11 insertions, 1 deletions
diff --git a/src/backend/parser/parse_relation.c b/src/backend/parser/parse_relation.c index 6d5fb189406..68855a70074 100644 --- a/src/backend/parser/parse_relation.c +++ b/src/backend/parser/parse_relation.c @@ -8,7 +8,7 @@ * * * IDENTIFICATION - * $PostgreSQL: pgsql/src/backend/parser/parse_relation.c,v 1.130 2008/01/01 19:45:51 momjian Exp $ + * $PostgreSQL: pgsql/src/backend/parser/parse_relation.c,v 1.131 2008/04/05 01:58:20 tgl Exp $ * *------------------------------------------------------------------------- */ @@ -1025,6 +1025,16 @@ addRangeTableEntryForJoin(ParseState *pstate, 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; |