SQLite Forum

Bug report: strange error message in cte and window function
Login
Hello,

I used my fuzzing tool to test sqlite of latest version, and found that it returned stange error message when processing a sql.

Test command:

`rm test.db; ./sqlite3 test.db < fuzz.sql`

The content of fuzz.sql:

`create table t_sa ( 
c_muyat INTEGER NOT NULL,
c_d4u TEXT ,
c_lngdt TEXT NOT NULL,
c_c3v INTEGER ,
primary key(c_c3v),
unique(c_muyat),
check(1=1)
);`

`WITH 
cte_0 AS (select       
    ref_0.c_muyat as c1
  from 
    t_sa as ref_0
)
select  
  LAG(cast(cast(null as INTEGER) as INTEGER)) over gen8fjew as c0
from 
  t_sa as ref_5
window gen8fjew as ( partition by (select c1 from cte_0 order by c1 limit 1 offset 4));`

The returned error message is:

`Error: near line 11: no such table: cte_0`

It seems to be a bug since cte_0 has been created.