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

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.

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

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

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

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

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

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

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

[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