aboutsummaryrefslogtreecommitdiff
path: root/src/backend/parser/parse_clause.c
diff options
context:
space:
mode:
authorAlvaro Herrera <alvherre@alvh.no-ip.org>2022-05-18 20:28:31 +0200
committerAlvaro Herrera <alvherre@alvh.no-ip.org>2022-05-18 20:28:31 +0200
commit0fbf0112002355efb2bb525ab88edf891dbfd033 (patch)
treed7502d8094aaabafce51d66c914f2f11370a1e4d /src/backend/parser/parse_clause.c
parent598ac10be1c20961baac44db773eb826f788fdfa (diff)
downloadpostgresql-0fbf0112002355efb2bb525ab88edf891dbfd033.tar.gz
postgresql-0fbf0112002355efb2bb525ab88edf891dbfd033.zip
Check column list length in XMLTABLE/JSON_TABLE alias
We weren't checking the length of the column list in the alias clause of an XMLTABLE or JSON_TABLE function (a "tablefunc" RTE), and it was possible to make the server crash by passing an overly long one. Fix it by throwing an error in that case, like the other places that deal with alias lists. In passing, modify the equivalent test used for join RTEs to look like the other ones, which was different for no apparent reason. This bug came in when XMLTABLE was born in version 10; backpatch to all stable versions. Reported-by: Wang Ke <krking@zju.edu.cn> Discussion: https://postgr.es/m/17480-1c9d73565bb28e90@postgresql.org
Diffstat (limited to 'src/backend/parser/parse_clause.c')
-rw-r--r--src/backend/parser/parse_clause.c15
1 files changed, 0 insertions, 15 deletions
diff --git a/src/backend/parser/parse_clause.c b/src/backend/parser/parse_clause.c
index e2baa9d852e..249255b65f5 100644
--- a/src/backend/parser/parse_clause.c
+++ b/src/backend/parser/parse_clause.c
@@ -1445,21 +1445,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.