Hi! Can anyone help me an diagnose sqldeligt issue...
# squarelibraries
d
Hi! Can anyone help me an diagnose sqldeligt issue? I have
Copy code
CREATE VIEW series_full AS
SELECT series.id, series.name
FROM series
JOIN series_category ON series_category.id = series.id
ORDER BY rowid ASC;

find_one_by_id:
SELECT *
FROM series_full
WHERE id = ?;
I get an exception:
Copy code
SQLiteException: no such table: series_full (code 1): , while compiling: SELECT * FROM series_full  WHERE id = ?1
I tried • specifying "series.id = ?" in WHERE • specifying "series_full.id =?" in WHERE Still same exception
Oh. turns out sqlite doesn't support WHERE's for views
y
really? I'm using WHERE in Room, and also confirmed by quick testing with DB Browser for SQLite
but yeah, SQLDelight plugin shows warning 🤔
d
You have views in room?
y
yes, I can use WHERE with view in Room, so it should be possible in SQLDelight too.
d
Hmm. It's strange, perhaps I should file an issue on sqldelight's github then, can attach a sample project if needed. @alec what do you think?
a
yea that definitely seems like a bug. I wonder if its confused by the table names - does aliasing
linked.linked_id
to
linked.linked_id AS linked_id
in the view's select work?
d
I recall that I tried explicitly prefixing column with table/view name in WHERE clause, both failed, but I don't remember if I tried aliasing. Will try and describe in an issue then.
a
thanks