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
Is your feature request related to a problem? Please describe.
LIMIT and OFFSET queries with scalar subquery expressions fail to parse.
Describe the solution you'd like
A clear and concise description of what you want to happen.
I'd like these to parse successfully.
Describe alternatives you've considered
A clear and concise description of any alternative solutions or features you've considered.
I've considered executing SQL and inlining the result, but that seems suboptimal given the support
in SQL for it.
Additional context
I'm testing with the duckdb dialect.
In [13]: import sqlglot as sg
In [14]: sg.__version__
Out[14]: '17.6.0'
In [15]: sg.parse_one("select * from t limit (select count(*) from t)", read="duckdb")
...
ParseError: Required keyword: 'expression' missing for <class 'sqlglot.expressions.Limit'>. Line 1, Col: 29.
select * from t limit (select count(*) from t)
Similarly for offset:
In [16]: sg.parse_one("select * from t offset (select count(*) from t)", read="duckdb")
...
ParseError: Required keyword: 'expression' missing for <class 'sqlglot.expressions.Offset'>. Line 1, Col: 24.
select * from t offset (select count(*) from t)
Both are supported using DuckDB:
D create or replace table t as select unnest(range(10)) as x;
D table t;
┌───────┐
│ x │
│ int64 │
├───────┤
│ 0 │
│ 1 │
│ 2 │
│ 3 │
│ 4 │
│ 5 │
│ 6 │
│ 7 │
│ 8 │
│ 9 │
└───────┘
D select * from t limit (select count(*) - 5 from t);
┌───────┐
│ x │
│ int64 │
├───────┤
│ 0 │
│ 1 │
│ 2 │
│ 3 │
│ 4 │
└───────┘
D select * from t offset (select count(*) - 5 from t);
┌───────┐
│ x │
│ int64 │
├───────┤
│ 5 │
│ 6 │
│ 7 │
│ 8 │
│ 9 │
└───────┘
The text was updated successfully, but these errors were encountered:
Is your feature request related to a problem? Please describe.
LIMIT
andOFFSET
queries with scalar subquery expressions fail to parse.Describe the solution you'd like
A clear and concise description of what you want to happen.
I'd like these to parse successfully.
Describe alternatives you've considered
A clear and concise description of any alternative solutions or features you've considered.
I've considered executing SQL and inlining the result, but that seems suboptimal given the support
in SQL for it.
Additional context
I'm testing with the duckdb dialect.
Similarly for
offset
:Both are supported using DuckDB:
The text was updated successfully, but these errors were encountered: