-
Notifications
You must be signed in to change notification settings - Fork 1
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
Fix phantom fields for boolean literals #84
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I guess I can approve seems this doesn't seem a regression, do we need to track that as a separate issue?
;; the top-level query. | ||
{:source-columns [{:column "x"} | ||
;; We are not excluding the CTE, whose outputs are known, as a source for y. | ||
{:column "y"}]}} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think the result here is incorrect, because x
is from both t1
and t2
, since cte
is not referenced anywhere:
testmetabase=# with cte as (select id from core_user limit 1) select id, name from report_card limit 2;
id | name
----+--------------------------------
2 | Orders with People
1 | Aerodynamic Copper Knife trend
(2 rows)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Whoops, I meant for cte
to be in scope.
mysql > with cte as (select id from core_user limit 1)
select id name from report_card join cte limit 2;
ERROR 1052 (23000): Column 'id' in field list is ambiguous
Since Macaw is garbage-in-garbage-out for invalid queries, I think the correct conclusion is that id come from core_user
only.
As for the actual query I wrote here, I guess you're right that in the short term returning both qualifications makes the most sense. One could imagine it doing some "dead scope analysis" however and excluding both the table and fields for the unused CTE.
I see all the CTE and subselect defects being nested under metabase/metabase#42586 Hmm, going to start adding ticket references to each :override for good measure. |
@@ -4,6 +4,7 @@ | |||
{:table "report_dashboardcard", :column "card_id"} | |||
{:table "report_dashboardcard", :column "created_at"}] ;; from outer select | |||
|
|||
;; See https://github.com/metabase/metabase/issues/42586 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Using links instead of just #1212312
to disambiguate whether it's tracked in metabase or macaw.
Pretty straight forward. Also adds a failing test with override for CTEs.