SQLite Forum

Reference to RECURSIVE table column apparently not allowed in nested SELECT
Login
It appears that in the current tip correlated subqueries are indeed permitted in recursive expressions and that they work just fine.

```
SQLite version 3.35.0 2020-12-11 14:46:25
Enter ".help" for usage hints.
Connected to a transient in-memory database.
Use ".open FILENAME" to reopen on a persistent database.
sqlite> create table x(x);
sqlite> insert into x values (6);
sqlite> with recursive y(y,z) as (values (1,1) union all select y+1, (select x from x where x == y) from y limit 10) select * from y;
┌────┬───┐
│ y  │ z │
├────┼───┤
│ 1  │ 1 │
│ 2  │   │
│ 3  │   │
│ 4  │   │
│ 5  │   │
│ 6  │   │
│ 7  │ 6 │
│ 8  │   │
│ 9  │   │
│ 10 │   │
└────┴───┘
```

which is what I would expect.  Either this has been "fixed" or the nonsensical use by the OP is just tossing the wrong error message when attempting to bugger with the limit of a scalar subquery which must be scalar (ie, 1).