Laurent LAVAUD wrote:
I have a problem to get < RAISE > function working.

When the trigger is triggered by an insert, i only want to execute the <
update > and skip the first insert.

So i tried this with sqlite version 3.3.8 :

----------------------------------------------------------------------

create table blocked (

   id    character varying(200),

   ips   character varying(40),

   ipd   character varying(40),

   proto smallint,

   pd    integer,

   hits  bigint default 1

);

create trigger checkdrop before INSERT on blocked when (select count(*)
from blocked where id=new.id) > 0

BEGIN

when

update blocked set hits = hits + 1 where id = new.id;

RAISE (IGNORE)

END;

----------------------------------------------------------------------

But i have a syntax error.

I would like to have an equivalent from postgresql with the < return
null > possibility.


Laurent,

What you have should work with a couple of minor changes;

   create table blocked (
      id    character varying(200),
      ips   character varying(40),
      ipd   character varying(40),
      proto smallint,
      pd    integer,
      hits  bigint default 1
   );

   create trigger checkdrop before INSERT on blocked
   when (select count(*) from blocked where id=new.id) > 0
   BEGIN
       update blocked set hits = hits + 1 where id = new.id;
       select RAISE (IGNORE);
   END;

HTH
Dennis Cote

-----------------------------------------------------------------------------
To unsubscribe, send email to [EMAIL PROTECTED]
-----------------------------------------------------------------------------

Reply via email to