-
Notifications
You must be signed in to change notification settings - Fork 1.6k
ALIAS hides the original column name in CASE with a window function #6769
Copy link
Copy link
Closed
Labels
BugIncorrect or unexpected behaviorIncorrect or unexpected behaviorSQLIssues or changes relating to SQL executionIssues or changes relating to SQL execution
Description
To reproduce
Go to demo and run this query (it works):
select timestamp, price as p,
case when price > 1 then price
when price < 1 then -p
END
from fx_trades;As you can see, I can reference the price column either by the original name or by the p alias inside the WHEN statements. All good
Now, let's add a window function inside the WHEN and try to use the unaliased price name. Oh, no! invalid column: price
select timestamp, price as p,
case when price > lag(price) OVER (ORDER BY timestamp) then price
END
from fx_trades;But I can still reference the column by the p alias.
select timestamp, price as p,
case when price > lag(price) OVER (ORDER BY timestamp) then p
END
from fx_trades;This looks like a bug to me
QuestDB version:
9.3.2
OS, in case of Docker specify Docker and the Host OS:
Public questdb demo box
File System, in case of Docker specify Host File System:
ext4
Full Name:
Javier Ramirez
Affiliation:
QuestDB
Have you followed Linux, MacOs kernel configuration steps to increase Maximum open files and Maximum virtual memory areas limit?
- Yes, I have
Additional context
No response
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
BugIncorrect or unexpected behaviorIncorrect or unexpected behaviorSQLIssues or changes relating to SQL executionIssues or changes relating to SQL execution