Hello Gang, 
This is my first question on this mail list. I noticed that BEFORE UPDATE 
trigger goes off even for insert statements.  

My example:
CREATE TRIGGER validate_players_update BEFORE UPDATE ON players
        WHEN (new.role in (1,2) and
            (select count(*) from players where table_group_id = 
new.table_group_id
                                                    and table_id = new.table_id
                                                    and role = new.role))

        BEGIN
            SELECT RAISE(FAIL, "1002: Can not sit player at this role at the 
table");
        END;


INSERT INTO players (device_id,table_group_id,table_id,role ) VALUES((select 
device_id from registrations where mesg_token ="aaaaaa"), 1, 2 , 2);
2009-06-02 10:43:36,086 SQLEngine->pysqlite2.dbapi2.IntegrityError
Traceback (most recent call last):
  File "SQLEngine.py", line 39, in executeUpdate
    self.cur.execute(SQL, args)
IntegrityError: 1002: Can not sit player at this role at the table


Can someone please shed a light on this issue? 
Thanks, 
Boris 



      
_______________________________________________
sqlite-users mailing list
sqlite-users@sqlite.org
http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users

Reply via email to