dbTalk Databases Forums  

[Info-Ingres] before trigger,an index and a weird delete result....how has your day been?

comp.databases.ingres comp.databases.ingres


Discuss [Info-Ingres] before trigger,an index and a weird delete result....how has your day been? in the comp.databases.ingres forum.



Reply
 
Thread Tools Display Modes
  #1  
Old   
Martin Bowes
 
Posts: n/a

Default [Info-Ingres] before trigger,an index and a weird delete result....how has your day been? - 05-28-2010 , 07:52 AM






Hi All,



On 9.2 try this...



First set up some data...

sql bowtest << SQL_END

\r

set autocommit on;

\p\g

drop table x;

\p\g

create table x(

a varchar(32) not null not default,

b varchar(32) not null not default,

c integer not null not default

) with nojournaling;

\p\g

insert into x values('one', 'one', 1);

insert into x values('one', 'two', 2);

insert into x values('one', 'three', 3);

insert into x values('one', 'four', 4);

insert into x values('two', 'one', 1);

insert into x values('two', 'two', 2);

insert into x values('two', 'three', 3);

insert into x values('three', 'one', 1);

\p\g

modify x to isam unique on b, a;

create index x_idx on x (a, c) with structure=isam, key=(a,c);

\p\g

drop procedure del_proc;

\p\g

create procedure del_proc

as declare

i integer not null;

begin

i = 0;

end;

\p\g

create rule before_del before delete on x

for each row execute procedure del_proc;

\p\g

\q

SQL_END



And now for the delete...

sql bowtest << SQL_END

select count(*) from x where a='one'; -- I get 4 rows

delete from x where a='one'; -- I get 1 row!

select count(*) from x where a='one'; -- I get 3 rows.

\p\g

rollback

\p\g

drop index x_idx;

\p\g

select count(*) from x where a='one'; -- 4 rows again

delete from x where a='one'; -- 4 rows (as expected)

select count(*) from x where a='one'; -- 0 rows (as expected)

\p\g

rollback

\p\g

\q

SQL_END



I was using II 9.2.0 (a64.lnx/143)NPTL + p13767



BTW. Change the rule to an after trigger and all is OK.



Martin Bowes

Reply With Quote
  #2  
Old   
Karl Schendel
 
Posts: n/a

Default Re: [Info-Ingres] before trigger,an index and a weird delete result....how has your day been? - 05-28-2010 , 08:15 AM






On May 28, 2010, at 8:52 AM, Martin Bowes wrote:

Quote:
...
And now for the delete…
sql bowtest << SQL_END
select count(*) from x where a='one'; -- I get 4 rows
delete from x where a='one'; -- I get 1 row!
select count(*) from x where a='one'; -- I get 3 rows.
...I was using II 9.2.0 (a64.lnx/143)NPTL + p13767

BTW. Change the rule to an after trigger and all is OK.

I think this is fixed in main (10.0). Main change 497731
brought over a bunch of stuff I did at Datallegro, including
this qeadelete.c fix. I doubt that the entire change can be
crossed to 9.2, but the relevant fix could be, if you asks
nicely. :-) (The bug is that the dmr_cb->dmr_tid is being
zeroed upon entry, which is incorrect if it's a re-entry
after a before trigger; the dmr_tid doesn't get set.)

Karl

Reply With Quote
Reply




Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off



Powered by vBulletin Version 3.5.3
Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.