-
Notifications
You must be signed in to change notification settings - Fork 218
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Multiple join seems buggy #1086
Comments
Thanks for the issue @eitsupi There are a couple of issues on this that we're working through, as part of a broader refactor. #820 is an example. It's useful to have additional examples. Could you show the query you think it should produce? I wasn't sure what "use WITH one more time" referred to. Thanks! |
I don't think this was reported already. It seems that the problem is that If so, this will probably be solved by #593. |
Thank you for your reply and sorry for the lack of explanation. WITH table_0 AS (
SELECT
tbl_a.*,
ROW_NUMBER() OVER (
PARTITION BY id,
col_a
ORDER BY
col_a
) AS _rn_88
FROM
tbl_a
),
table_1 AS (
SELECT
id AS id_a,
col_b
FROM
table_0
WHERE
_rn_88 <= 1
),
table_2 AS (
SELECT
id AS id_b,
id_a,
col_b
FROM
table_1
LEFT JOIN tbl_b USING(id_a)
),
SELECT
id_a,
id_b,
col_b,
col_c
FROM
table_2
LEFT JOIN tbl_c USING(id_b) I think the generated SQL's last join will fail because the left table does not have Sorry the column names are confusing, but the purpose is to join multiple tables by traversing foreign keys. |
Yes, this is a bug. I don't think it a problem with multiple joins, but how USING is implemented. Here is a minimal example: from tbl_a
select id_b = id
join tbl_b id_b I'm fairly certain that #593 indeed solves this, let's revisit this issue when it merges in a few weeks. |
This has indeed been solved: from tbl_a
select id_b = id
join tbl_b [~id_b] SELECT
tbl_b.*,
tbl_a.id AS id_b
FROM
tbl_a
JOIN tbl_b ON tbl_a.id = tbl_b.id_b |
Sorry if this has already been reported.
Queries containing multiple joins do not seem to translate well to SQL?
In the following example, I think it need to use WITH one more time.
The text was updated successfully, but these errors were encountered: