aboutsummaryrefslogtreecommitdiff
path: root/src/backend/parser/analyze.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/backend/parser/analyze.c')
-rw-r--r--src/backend/parser/analyze.c14
1 files changed, 13 insertions, 1 deletions
diff --git a/src/backend/parser/analyze.c b/src/backend/parser/analyze.c
index c338e0f2281..8ea47922b18 100644
--- a/src/backend/parser/analyze.c
+++ b/src/backend/parser/analyze.c
@@ -6,7 +6,7 @@
* Portions Copyright (c) 1996-2003, PostgreSQL Global Development Group
* Portions Copyright (c) 1994, Regents of the University of California
*
- * $Header: /cvsroot/pgsql/src/backend/parser/analyze.c,v 1.290.2.1 2003/11/05 22:00:52 tgl Exp $
+ * $Header: /cvsroot/pgsql/src/backend/parser/analyze.c,v 1.290.2.2 2004/11/17 00:18:26 neilc Exp $
*
*-------------------------------------------------------------------------
*/
@@ -440,6 +440,18 @@ transformStmt(ParseState *pstate, Node *parseTree,
result->querySource = QSRC_ORIGINAL;
result->canSetTag = true;
+ /*
+ * Check that we did not produce too many resnos; at the very
+ * least we cannot allow more than 2^16, since that would exceed
+ * the range of a AttrNumber. It seems safest to use
+ * MaxTupleAttributeNumber.
+ */
+ if (pstate->p_next_resno - 1 > MaxTupleAttributeNumber)
+ ereport(ERROR,
+ (errcode(ERRCODE_PROGRAM_LIMIT_EXCEEDED),
+ errmsg("target lists can have at most %d entries",
+ MaxTupleAttributeNumber)));
+
return result;
}