mirror of
https://github.com/postgres/postgres.git
synced 2025-08-27 07:42:10 +03:00
Allow an alias to be attached to a JOIN ... USING
This allows something like SELECT ... FROM t1 JOIN t2 USING (a, b, c) AS x where x has the columns a, b, c and unlike a regular alias it does not hide the range variables of the tables being joined t1 and t2. Per SQL:2016 feature F404 "Range variable for common column names". Reviewed-by: Vik Fearing <vik.fearing@2ndquadrant.com> Reviewed-by: Tom Lane <tgl@sss.pgh.pa.us> Discussion: https://www.postgresql.org/message-id/flat/454638cf-d563-ab76-a585-2564428062af@2ndquadrant.com
This commit is contained in:
@@ -457,6 +457,7 @@ add_rte_to_flat_rtable(PlannerGlobal *glob, RangeTblEntry *rte)
|
||||
newrte->joinaliasvars = NIL;
|
||||
newrte->joinleftcols = NIL;
|
||||
newrte->joinrightcols = NIL;
|
||||
newrte->join_using_alias = NULL;
|
||||
newrte->functions = NIL;
|
||||
newrte->tablefunc = NULL;
|
||||
newrte->values_lists = NIL;
|
||||
|
@@ -1365,6 +1365,7 @@ convert_ANY_sublink_to_join(PlannerInfo *root, SubLink *sublink,
|
||||
result->larg = NULL; /* caller must fill this in */
|
||||
result->rarg = (Node *) rtr;
|
||||
result->usingClause = NIL;
|
||||
result->join_using_alias = NULL;
|
||||
result->quals = quals;
|
||||
result->alias = NULL;
|
||||
result->rtindex = 0; /* we don't need an RTE for it */
|
||||
@@ -1519,6 +1520,7 @@ convert_EXISTS_sublink_to_join(PlannerInfo *root, SubLink *sublink,
|
||||
else
|
||||
result->rarg = (Node *) subselect->jointree;
|
||||
result->usingClause = NIL;
|
||||
result->join_using_alias = NULL;
|
||||
result->quals = whereClause;
|
||||
result->alias = NULL;
|
||||
result->rtindex = 0; /* we don't need an RTE for it */
|
||||
|
Reference in New Issue
Block a user