Skip to content
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

unable to use projection expr in later predicate #2702

Open
universalmind303 opened this issue Feb 23, 2024 · 1 comment
Open

unable to use projection expr in later predicate #2702

universalmind303 opened this issue Feb 23, 2024 · 1 comment
Labels
syntax Issues or features related to our SQL syntax ux 💎 Convenience label for grouping UX issues

Comments

@universalmind303
Copy link
Contributor

Description

MRE

> select null as v 
::: from './testdata/csv/userdata1.csv'
::: where v is not null;
Error: Schema error: No field named v. Valid fields are "./testdata/csv/userdata1.csv".registration_dttm, "./testdata/csv/userdata1.csv".id, "./testdata/csv/userdata1.csv".first_name, "./testdata/csv/userdata1.csv".last_name, "./testdata/csv/userdata1.csv".email, "./testdata/csv/userdata1.csv".gender, "./testdata/csv/userdata1.csv".ip_address, "./testdata/csv/userdata1.csv".cc, "./testdata/csv/userdata1.csv".country, "./testdata/csv/userdata1.csv".birthdate, "./testdata/csv/userdata1.csv".salary, "./testdata/csv/userdata1.csv".title, "./testdata/csv/userdata1.csv".comments.

Note: you can order by the expr, but not filter by it.

select 1 as v, * from './testdata/csv/userdata1.csv' order by v;

Additional Context.

This works as expected in duckdb and clickhouse.

@universalmind303 universalmind303 added the bug 🐛 Something isn't working label Feb 23, 2024
@scsmithr
Copy link
Member

fwiw this doesn't work in postgres

postgres=# select a as aa from (values (1), (2)) t1(a) where a = 1;
 aa 
----
  1
(1 row)

postgres=# select a as aa from (values (1), (2)) t1(a) where aa = 1;
ERROR:  column "aa" does not exist
LINE 1: select a as aa from (values (1), (2)) t1(a) where aa = 1;
                                                          ^
HINT:  Perhaps you meant to reference the column "t1.a".

@tychoish tychoish added ux 💎 Convenience label for grouping UX issues syntax Issues or features related to our SQL syntax and removed bug 🐛 Something isn't working labels Apr 9, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
syntax Issues or features related to our SQL syntax ux 💎 Convenience label for grouping UX issues
Projects
None yet
Development

No branches or pull requests

3 participants