Why does the first query below work in Firefox SQLite manager, while the second doesn't? Why do both fail in SQL Fiddle using SQLite, MySQL, PostGreSQL, et al?
create trigger symmetric_insertion
after insert on T
for each row
when not exists (select * from T where T.A = New.B and T.B = New.A)
begin
insert into T values (New.B, New.A);
end;
.
create trigger symmetric_insertion
after insert on T
for each row
begin
insert into T values (New.B, New.A)
where not exists (select * from T where T.A = New.B and T.B = New.A);
end;
EDIT: An infinite loop would not be created, because I have not turned the recursive_triggers setting to be true. Furthermore, MySQL allows only a finite depth of recursion.