convert duckdb sql to sqlite make wrong result #2995
-
I did it with >>> import sqlglot
>>> sqlglot.transpile("WITH t AS( SELECT i, i*i*i*i*i AS i5 FROM range(1,5)t(i) )select * from t","duckdb","sqlite")
['WITH t AS (SELECT i, i * i * i * i * i AS i5 FROM RANGE(1, 5) AS t(i)) SELECT * FROM t'] and run in sqlite failed. D:\>sqlite\sqlite345
SQLite version 3.45.0 2024-01-15 17:01:13 (UTF-16 console I/O)
Enter ".help" for usage hints.
Connected to a transient in-memory database.
Use ".open FILENAME" to reopen on a persistent database.
sqlite> WITH t AS (SELECT i, i * i * i * i * i AS i5 FROM RANGE(1, 5) AS t(i)) SELECT * FROM t;
Parse error: near "(": syntax error
T i, i * i * i * i * i AS i5 FROM RANGE(1, 5) AS t(i)) SELECT * FROM t;
error here ---^ there are two problems
|
Beta Was this translation helpful? Give feedback.
Answered by
georgesittas
Feb 22, 2024
Replies: 3 comments
-
following sql works in sqlite sqlite> WITH t AS (SELECT i, i * i * i * i * i AS i5 FROM (select value as i from generate_series(1, 5)) ) SELECT * FROM t;
1|1
2|32
3|243
4|1024
5|3125 |
Beta Was this translation helpful? Give feedback.
0 replies
-
Hey, thanks for the report - we're actively looking into this and should have a fix soon. Please make sure to file an issue for any future bugs you encounter so that they're properly tracked. |
Beta Was this translation helpful? Give feedback.
0 replies
-
Solved in e50609b |
Beta Was this translation helpful? Give feedback.
0 replies
Answer selected by
georgesittas
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Solved in e50609b