@@ -368,6 +368,50 @@ create trigger insert_into_a
368368after insert on a
369369for each row replace into c
370370select d.x+2, 0 from d join b using (x)
371+ where d.x = new.x` ,
372+ "insert into a (x,z) values (2,2)" ,
373+ },
374+ Query : "select x, y from c order by 1" ,
375+ Expected : []sql.Row {
376+ {4 , 0 },
377+ },
378+ },
379+ {
380+ Name : "trigger insert projection group by index error" ,
381+ SetUpScript : []string {
382+ "create table a (x int primary key, y int default 1, z int)" ,
383+ "create table b (x int primary key)" ,
384+ "create table c (x int primary key, y tinyint)" ,
385+ "create table d (x int primary key)" ,
386+ "insert into b values (1), (2)" ,
387+ "insert into d values (1), (2)" ,
388+ `
389+ create trigger insert_into_a
390+ after insert on a
391+ for each row replace into c
392+ select max(d.x + new.x), 0 from d join b using (x)
393+ where d.x = new.x` ,
394+ "insert into a (x,z) values (2,2)" ,
395+ },
396+ Query : "select x, y from c order by 1" ,
397+ Expected : []sql.Row {
398+ {4 , 0 },
399+ },
400+ },
401+ {
402+ Name : "trigger insert projection window index error" ,
403+ SetUpScript : []string {
404+ "create table a (x int primary key, y int default 1, z int)" ,
405+ "create table b (x int primary key)" ,
406+ "create table c (x int primary key, y tinyint)" ,
407+ "create table d (x int primary key)" ,
408+ "insert into b values (1), (2)" ,
409+ "insert into d values (1), (2)" ,
410+ `
411+ create trigger insert_into_a
412+ after insert on a
413+ for each row replace into c
414+ select first_value(d.x + new.x) over (partition by (x) order by x), 0 from d join b using (x)
371415where d.x = new.x` ,
372416 "insert into a (x,z) values (2,2)" ,
373417 },
0 commit comments