SQLite Forum

CTEs in triggers
Login
Be that as it may, the following are identical semantics with different spellings, yet one is an error and the other is not.

```
sqlite> create trigger xx after insert on x begin
   ...> with t as (select * from new) insert into y select x from t;
   ...> end;
Error: near "insert": syntax error
sqlite> create trigger xx after insert on x begin
   ...> insert into y select x from (select * from new);
   ...> end;
sqlite>
```

So you are saying that the use of WITH (CTE's) where they are "rejected" are not supported but uses where they are not rejected are supported, despite documentation to the contrary?

And that you would have (somehow) a different expectation because the following spelling is not rejected:

```
sqlite> create trigger xx after insert on x begin
   ...> insert into y select x from (with t as (select * from new) select x from t);
   ...> end;
sqlite>
```