KiteSQL icon indicating copy to clipboard operation
KiteSQL copied to clipboard

Fix: the fields output by Using are not determined by JoinType

Open KKould opened this issue 1 year ago • 1 comments

Bug Report

statement ok
CREATE TABLE onecolumn (id INT PRIMARY KEY, x INT NULL)

statement ok
CREATE TABLE empty (e_id INT PRIMARY KEY, x INT)

statement ok
INSERT INTO onecolumn(id, x) VALUES (0, 44), (1, NULL), (2, 42)

# FIXME: The fields output by Using are determined by JoinType.
query I
SELECT * FROM onecolumn AS a LEFT OUTER JOIN empty AS b USING(x) ORDER BY x
----
null null 2
null 42 0
null 44 1

KKould avatar Apr 10 '24 18:04 KKould

Since using will generate column with the same name, only the column that are used once should be returned at this time, and the returned column should be selected from the left table or the right table according to JoinType.

KKould avatar Aug 08 '24 17:08 KKould