You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Variable is discarded silently with no type error #5158
Variable is discarded when I expect it to be used. Ideally, the variable would just be used as defined. In the worst case, this should at least be a type error.
PRQL input
prql target:sql.postgres
let mod_id =(from users | filter login =="nightpool"| select id | take 1)from events
filter actor_id == mod_id
sort (-event_occurred_at)take 10
SQL output
SELECT*FROM
events
WHERE
actor_id = mod_id
ORDER BY
event_occurred_at DESCLIMIT10
Expected SQL output
SELECT*FROM
events
WHERE
actor_id = (select id from users where login ='nightpool'limit1)
ORDER BY
event_occurred_at DESCLIMIT10
MVCE confirmation
Minimal example
New issue
Anything else?
I can't get PRQL to generate a subquery at all in any format. Maybe there's something i'm missing? "into mod_id" also has the same issue.
Activity
max-sixty commentedon Feb 19, 2025
Yes, agree, this looks like a bug. I'll try and take a look deeper, though it's likely a bug in the resolver which we're considering overhauling...
fix: error when table variable used in scalar context