Re: [sqlite] trigger on update bug in 3.6.20?

2009-11-25 Thread Jean-Denis Muys
On 11/25/09 17:35 , "Vasu Nori" wrote: >> I have to disagree. failing safely is better than failing silently. > thanks for the discussion. (except I don't see the c++ analogy :) ) My eyes, my time, and my bandwidth would appreciate it if you could avoid quoting five full screens of irreleva

Re: [sqlite] trigger on update bug in 3.6.20?

2009-11-25 Thread Vasu Nori
On Wed, Nov 25, 2009 at 4:43 AM, Pavel Ivanov wrote: > Try to look at things not from the point of view of your application > but from the point of view of the SQLite itself. > > > 1. backward compatibility. It worked before upto 3.6.16. so, probably > it > > should work the same now. > > It

Re: [sqlite] trigger on update bug in 3.6.20?

2009-11-25 Thread Pavel Ivanov
Try to look at things not from the point of view of your application but from the point of view of the SQLite itself. > 1. backward compatibility. It worked before upto 3.6.16. so, probably it > should work the same now. It was undefined behavior up to 3.6.16, it is undefined behavior now. It

Re: [sqlite] trigger on update bug in 3.6.20?

2009-11-24 Thread Vasu Nori
On Tue, Nov 24, 2009 at 12:28 PM, Pavel Ivanov wrote: > > I am not what you mean by Oracle's Before triggers have different > concept? > > care to explain? > > Sure. When Oracle calls your before update trigger it provides you old > values of the row and storage for new values of the row. You can

Re: [sqlite] trigger on update bug in 3.6.20?

2009-11-24 Thread Pavel Ivanov
> I am not what you mean by Oracle's Before triggers have different concept? > care to explain? Sure. When Oracle calls your before update trigger it provides you old values of the row and storage for new values of the row. You can change whatever you like in this storage and be sure that it will

Re: [sqlite] trigger on update bug in 3.6.20?

2009-11-24 Thread Vasu Nori
On Tue, Nov 24, 2009 at 11:25 AM, Pavel Ivanov wrote: > > yes it is risky, in general. but in this specific case, I expect no > > problems. > > just as a reference, this works just fine on mysql and oracle.. > > and used to work quite well until sqlite 3.6.16. > > I don't know anything about MySQ

Re: [sqlite] trigger on update bug in 3.6.20?

2009-11-24 Thread Vasu Nori
On Tue, Nov 24, 2009 at 11:49 AM, D. Richard Hipp wrote: > > On Nov 24, 2009, at 1:15 PM, Vasu Nori wrote: > > > wondering if this is a known issue in 3.6.20. > > http://www.sqlite.org/lang_createtrigger.html#undef_before > > "If a BEFORE UPDATE or BEFORE DELETE trigger modifies or deletes a row

Re: [sqlite] trigger on update bug in 3.6.20?

2009-11-24 Thread Pavel Ivanov
Richard, >From the same link you gave: "Furthermore, if a BEFORE trigger modifies or deletes a row, then it is undefined whether or not AFTER triggers that would have otherwise run on those rows will in fact run." I believe in case of recursive triggers turned on this statement is incorrect and

Re: [sqlite] trigger on update bug in 3.6.20?

2009-11-24 Thread D. Richard Hipp
On Nov 24, 2009, at 1:15 PM, Vasu Nori wrote: > wondering if this is a known issue in 3.6.20. http://www.sqlite.org/lang_createtrigger.html#undef_before "If a BEFORE UPDATE or BEFORE DELETE trigger modifies or deletes a row that was to have been updated or deleted, then the result of the su

Re: [sqlite] trigger on update bug in 3.6.20?

2009-11-24 Thread Pavel Ivanov
> yes it is risky, in general. but in this specific case, I expect no > problems. > just as a reference, this works just fine on mysql and oracle.. > and used to work quite well until sqlite 3.6.16. I don't know anything about MySQL but Oracle has completely different concept of BEFORE UPDATE trig

Re: [sqlite] trigger on update bug in 3.6.20?

2009-11-24 Thread Vasu Nori
On Tue, Nov 24, 2009 at 10:26 AM, Igor Tandetnik wrote: > Vasu Nori wrote: > > wondering if this is a known issue in 3.6.20. > > > > create table t1(_id integer primary key, v integer, d integer); > > CREATE TRIGGER t1_trig BEFORE UPDATE ON t1 > > BEGIN > >update t1 SET v=OLD.v+1 WHERE NEW._

Re: [sqlite] trigger on update bug in 3.6.20?

2009-11-24 Thread Vasu Nori
On Tue, Nov 24, 2009 at 10:25 AM, Pavel Ivanov wrote: > > create table t1(_id integer primary key, v integer, d integer); > > CREATE TRIGGER t1_trig BEFORE UPDATE ON t1 > > BEGIN > >update t1 SET v=OLD.v+1 WHERE NEW._id=OLD._id AND NEW.d!= OLD.d; > > END; > > I guess your trigger does somet

Re: [sqlite] trigger on update bug in 3.6.20?

2009-11-24 Thread Igor Tandetnik
Vasu Nori wrote: > wondering if this is a known issue in 3.6.20. > > create table t1(_id integer primary key, v integer, d integer); > CREATE TRIGGER t1_trig BEFORE UPDATE ON t1 > BEGIN >update t1 SET v=OLD.v+1 WHERE NEW._id=OLD._id AND NEW.d!= OLD.d; > END; Realize that your trigger updat

Re: [sqlite] trigger on update bug in 3.6.20?

2009-11-24 Thread Pavel Ivanov
> create table t1(_id integer primary key, v integer, d integer); > CREATE TRIGGER t1_trig BEFORE UPDATE ON t1 > BEGIN >update t1 SET v=OLD.v+1 WHERE NEW._id=OLD._id AND NEW.d!= OLD.d; > END; I guess your trigger does something different from what you wanted to do: it changes value of v in t

[sqlite] trigger on update bug in 3.6.20?

2009-11-24 Thread Vasu Nori
wondering if this is a known issue in 3.6.20. create table t1(_id integer primary key, v integer, d integer); CREATE TRIGGER t1_trig BEFORE UPDATE ON t1 BEGIN update t1 SET v=OLD.v+1 WHERE NEW._id=OLD._id AND NEW.d!= OLD.d; END; insert into t1 values(1, 1,0); update t1 set d= 2 where _i