---------- Original Message -----------
From: Adriano dos Santos Fernandes <[email protected]>
> When you create a view with check option as below:
> Firebird automatically creates triggers as below:
> 
> create trigger v1_ins before insert on v1
> as
> begin
>     if (not new.n1 < 10) then
>         exception;
>     end if;
> end!
------- End of Original Message -------

Tangent: what's the POSITION on these? I'm thinking in terms of compatibility 
between the auto-created triggers and additional triggers the user might want 
to 
add -- can users consistently add custom triggers before/after the auto-created 
ones?

view: where pertains_to_department = 'billing' WITH CHECK OPTION
before insert position 0: new.pertains_to_department = (select department_id 
from 
users where username = current_username);
before insert position 9999: if (not new.pertains_to_department = 'billing') 
then 
exception;

I suppose there's no solution if it's the underlying table that has the 
trigger, 
so the view can't limit it on the way in, it gets passed through, modified, 
inserted, and then *would* be unreachable by the view ... but by then the view 
doesn't care anymore. (Would only matter for a RETURNING clause?)

-Philip

------------------------------------------------------------------------------
Live Security Virtual Conference
Exclusive live event will cover all the ways today's security and 
threat landscape has changed and how IT managers can respond. Discussions 
will include endpoint security, mobile security and the latest in malware 
threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/
Firebird-Devel mailing list, web interface at 
https://lists.sourceforge.net/lists/listinfo/firebird-devel

Reply via email to