dimanche 27 mars 2016

Sqlite rowid > too many levels of trigger recursion, but trigger works fine?

I am having table: MYTABLE(ID int);

I am using this query to generate N numbers of rowids in mytable

  create trigger mytrigger after insert on MYTABLE
  when new.id < 1000 
  begin
  insert into MYTABLE select max(id)+1 from MYTABLE;
  end;
  insert into MYTABLE values (1);

It works fine, sqlite would generate me a rowid from 1 to 1000.

But when I subsitute

when new.id < 1000 

with larger number like

when new.id < 10000000

I receive an error: too many levels of trigger recursion

Now my question is, what's the point of trigger if it can not handle at least one million options? Is there any way to solve that or should i just go and insert each row by myself:)

Aucun commentaire:

Enregistrer un commentaire