diff options
| author | Peter Eisentraut <peter@eisentraut.org> | 2021-03-31 17:09:24 +0200 |
|---|---|---|
| committer | Peter Eisentraut <peter@eisentraut.org> | 2021-03-31 17:10:50 +0200 |
| commit | 055fee7eb4dcc78e58672aef146334275e1cc40d (patch) | |
| tree | 2034e69c471453e9aea59712b09d3fed95bce330 /src/backend/nodes/outfuncs.c | |
| parent | 27e1f14563cf982f1f4d71e21ef247866662a052 (diff) | |
| download | postgresql-055fee7eb4dcc78e58672aef146334275e1cc40d.tar.gz | |
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
Diffstat (limited to 'src/backend/nodes/outfuncs.c')
| -rw-r--r-- | src/backend/nodes/outfuncs.c | 2 |
1 files changed, 2 insertions, 0 deletions
diff --git a/src/backend/nodes/outfuncs.c b/src/backend/nodes/outfuncs.c index ff127a19ad..638b538100 100644 --- a/src/backend/nodes/outfuncs.c +++ b/src/backend/nodes/outfuncs.c @@ -1693,6 +1693,7 @@ _outJoinExpr(StringInfo str, const JoinExpr *node) WRITE_NODE_FIELD(larg); WRITE_NODE_FIELD(rarg); WRITE_NODE_FIELD(usingClause); + WRITE_NODE_FIELD(join_using_alias); WRITE_NODE_FIELD(quals); WRITE_NODE_FIELD(alias); WRITE_INT_FIELD(rtindex); @@ -3193,6 +3194,7 @@ _outRangeTblEntry(StringInfo str, const RangeTblEntry *node) WRITE_NODE_FIELD(joinaliasvars); WRITE_NODE_FIELD(joinleftcols); WRITE_NODE_FIELD(joinrightcols); + WRITE_NODE_FIELD(join_using_alias); break; case RTE_FUNCTION: WRITE_NODE_FIELD(functions); |
