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
Describe the bug
Right now, when you define a CTE using the WITH keyword, and want to use it in an IN operator directly, the build_runner fails and outputs
Expected opening parenthesis for tuple
In other words, the following works in SQLite:
WITH names AS (
SELECT name FROM persons
)
SELECT*,
'John'IN names AS john_exists
FROM my_table
Whereas in Drift, this would result in the error above, and you need to do the following instead:
WITH names AS (
SELECT name FROM persons
)
SELECT*,
'John'IN (SELECT*FROM names) AS john_exists
FROM my_table
Nothing very major or broken, but it'd be nice if I was able to directly use the CTEs in my query
Full sample to illustrate the problem
CREATETABLEcars (
id INTEGERNOT NULLPRIMARY KEY AUTOINCREMENT,
wheels INTEGER DEFAULT 4,
model TEXT
);
CREATETABLEcolors (
id INTEGERNOT NULLPRIMARY KEY AUTOINCREMENT,
color TEXT
);
INSERT INTO colors (color) VALUES
('red'),
('green'),
('blue'),
('yellow'),
('black'),
('brown');
INSERT INTO cars (model, wheels)
VALUES ('Reliant Robin', 3), ('Opel Vectra', 4), ('Volkswagen ID.3', 4);
WITH colors_with_b AS (
SELECT color FROM colors WHERE color LIKE'b%'
)
SELECT
model,
'blue'IN colors_with_b AS available_in_blue,
'green'IN colors_with_b AS available_in_green
FROM cars;
The text was updated successfully, but these errors were encountered:
@simolus3 hey, unfortunately this does not work properly in the 2.17 release. The column name in the generated data class is incorrect (the data contained therein is fine, though)
It looks like it gets resolved to the textual content of the whole line, i.e. johninnamesASjohnExists, instead of just everything after AS, i.e. johnExists.
Describe the bug
Right now, when you define a CTE using the
WITH
keyword, and want to use it in anIN
operator directly, thebuild_runner
fails and outputsIn other words, the following works in SQLite:
Whereas in Drift, this would result in the error above, and you need to do the following instead:
Nothing very major or broken, but it'd be nice if I was able to directly use the CTEs in my query
Full sample to illustrate the problem
The text was updated successfully, but these errors were encountered: