TEMPORAL JOIN: USING clause attributes moved and duplicates deleted -> Wrong resjunk transformation
transformTemporalJoinResjunk(SelectStmt *stmt, Query *qry)
sets wrong columns to resjunk
.
Example:
A=# select * from (test t1 period join with(ts,te,ts,te) as (tts, tte) test t2 using(a,b)) c;
a | b | vs | ve
---+---+----+----
a | B | 1 | 7
b | B | 3 | 9
c | G | 8 | 10
(3 rows)
A=# select * from (test t1 period join with(ts,te,ts,te) as (tts, tte) test t2 using(a)) c;
a | b | b | vs | tte
---+---+---+----+-----
a | B | B | 1 | 7
b | B | B | 3 | 9
c | G | G | 8 | 10
(3 rows)
ON clause produces the following output:
A=# select * from (test t1 period join with(ts,te,ts,te) as (tts, tte) test t2 on t1.a = t2.a) c;
a | b | a | b | tts | tte
---+---+---+---+-----+-----
a | B | a | B | 1 | 7
b | B | b | B | 3 | 9
c | G | c | G | 8 | 10
(3 rows)
A USING-clause removes the second 3rd column a
(for using(a)
), or the 3rd and 4th columns a
and b
(for using(a,b)
)