summaryrefslogtreecommitdiff
path: root/src/backend/parser
diff options
context:
space:
mode:
Diffstat (limited to 'src/backend/parser')
-rw-r--r--src/backend/parser/parse_clause.c15
-rw-r--r--src/backend/parser/parse_relation.c12
2 files changed, 12 insertions, 15 deletions
diff --git a/src/backend/parser/parse_clause.c b/src/backend/parser/parse_clause.c
index edcaf276c0a..855e3b50b11 100644
--- a/src/backend/parser/parse_clause.c
+++ b/src/backend/parser/parse_clause.c
@@ -1435,21 +1435,6 @@ transformFromClauseItem(ParseState *pstate, Node *n,
res_nscolumns + res_colindex);
/*
- * Check alias (AS clause), if any.
- */
- if (j->alias)
- {
- if (j->alias->colnames != NIL)
- {
- if (list_length(j->alias->colnames) > list_length(res_colnames))
- ereport(ERROR,
- (errcode(ERRCODE_SYNTAX_ERROR),
- errmsg("column alias list for \"%s\" has too many entries",
- j->alias->aliasname)));
- }
- }
-
- /*
* Now build an RTE and nsitem for the result of the join.
* res_nscolumns isn't totally done yet, but that's OK because
* addRangeTableEntryForJoin doesn't examine it, only store a pointer.
diff --git a/src/backend/parser/parse_relation.c b/src/backend/parser/parse_relation.c
index af43a62cb25..12d1108c9ab 100644
--- a/src/backend/parser/parse_relation.c
+++ b/src/backend/parser/parse_relation.c
@@ -1963,6 +1963,12 @@ addRangeTableEntryForTableFunc(ParseState *pstate,
eref->colnames = list_concat(eref->colnames,
list_copy_tail(tf->colnames, numaliases));
+ if (numaliases > list_length(tf->colnames))
+ ereport(ERROR,
+ (errcode(ERRCODE_INVALID_COLUMN_REFERENCE),
+ errmsg("%s function has %d columns available but %d columns specified",
+ "XMLTABLE", list_length(tf->colnames), numaliases)));
+
rte->eref = eref;
/*
@@ -2140,6 +2146,12 @@ addRangeTableEntryForJoin(ParseState *pstate,
eref->colnames = list_concat(eref->colnames,
list_copy_tail(colnames, numaliases));
+ if (numaliases > list_length(colnames))
+ ereport(ERROR,
+ (errcode(ERRCODE_INVALID_COLUMN_REFERENCE),
+ errmsg("join expression \"%s\" has %d columns available but %d columns specified",
+ eref->aliasname, list_length(colnames), numaliases)));
+
rte->eref = eref;
/*