SQLite Forum

WHERE a IN (SELECT non-existing column )
Dear SQLiters,

I made a typo in SQL statement, but instead of getting error it succeeded. Is that expected?

WITH personList(concept_ID) AS (VALUES (1), (2), (3))
SELECT count() FROM PERSON WHERE person_ID IN (SELECT person_ID FROM personList) AND age >30;

As you see table personList() does not have column person_ID (because of a typo). The above simply counts people above 30 years old from the PERSON table, essentially discarding first condition entirely. However, the internal select:

WITH personList(concept_ID) AS (VALUES (1), (2), (3))
SELECT person_ID FROM personList;

fails because column person_ID does not exist. Is that normal behavior?

Thank you,