summaryrefslogtreecommitdiff
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 c3b547dd5b7..b68f28f8556 100644
--- a/src/backend/parser/analyze.c
+++ b/src/backend/parser/analyze.c
@@ -6,7 +6,7 @@
* Portions Copyright (c) 1996-2004, PostgreSQL Global Development Group
* Portions Copyright (c) 1994, Regents of the University of California
*
- * $PostgreSQL: pgsql/src/backend/parser/analyze.c,v 1.312 2004/09/27 04:12:02 neilc Exp $
+ * $PostgreSQL: pgsql/src/backend/parser/analyze.c,v 1.313 2004/11/16 23:34:26 neilc Exp $
*
*-------------------------------------------------------------------------
*/
@@ -396,6 +396,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;
}