Trigger Bug?
Posted in 1994
Topics: Triggers, Constraints & Referential Integrity
Netters,
I think I have run across a bug when using triggers. It occurs when using
the "CURRENT from TO to " syntax. I have not tried any other variations yet.
It does execute correctly but when the database is copied or a schema is
generated, the "from TO to" part is missing.
First create the Demo Database following the instructions on page 15 of
the introduction in the "Using Triggers" ver 5.01 manual.
Here's the SQL code that shows the "bad" behavior when defining a trigger.
-- start trigbug.sql
-- drop table log_record ;
-- drop trigger upqty_i;
create table log_record
(
item_num smallint,
ord_num integer,
username char(8),
update_time datetime year to minute,
old_qty smallint,
new_qty smallint
);
create trigger upqty_i update of quantity on items
referencing old as pre_upd new as post_upd
for each row( insert into log_record
values (pre_upd.item_num,pre_upd.order_num,user,current,
pre_upd.quantity,post_upd.quantity));
select * from systrigbody order by trigid,datakey,seqno;
-- The above trigger will look OK
drop trigger upqty_i;
create trigger upqty_i update of quantity on items
referencing old as pre_upd new as post_upd
for each row( insert into log_record
values (pre_upd.item_num,pre_upd.order_num,user,current year to minute,
pre_upd.quantity,post_upd.quantity));
select * from systrigbody order by trigid,datakey,seqno;
-- The above trigger will show up without the "year to minute"
-- end trigbug.sql
When I ran across this I was trying to stuff "CURRENT hour to minute" into
a CHAR(5). The example above was created to show that the "behavior" could
be reproduced with the Demo database to appease Informix Tech support.
Let me know if anyone else can reproduce this behavior or error.
Thanks,
John
Note: This DB-Access and SE version 5.01 UD3 for SCO Unix on the Compaq 486
--
==============================================================================
John R. Morris | email: jrm@hycel.com
Director of Data Processing | phone: (314) 961-2000 fax: (314) 961-8508
==============================================================================