Re: [sqlite] SQL language question

2009-09-23 Thread Nicolas Williams
On Wed, Sep 23, 2009 at 06:12:13PM +0100, Simon Slavin wrote: > > On 23 Sep 2009, at 5:12pm, Nicolas Williams wrote: > > > On Tue, Sep 22, 2009 at 04:45:31PM -0400, D. Richard Hipp wrote: > >> UPDATE t1 SET x=x; -- key line: Is this considered an "update" > >> of t1.x? > > > > Igor

Re: [sqlite] SQL language question

2009-09-23 Thread Simon Slavin
On 23 Sep 2009, at 5:12pm, Nicolas Williams wrote: > On Tue, Sep 22, 2009 at 04:45:31PM -0400, D. Richard Hipp wrote: >> UPDATE t1 SET x=x; -- key line: Is this considered an "update" >> of t1.x? > > Igor pointed to the standards text, which I think is quite reasonable: > an update is

Re: [sqlite] SQL language question

2009-09-23 Thread Nicolas Williams
On Tue, Sep 22, 2009 at 04:45:31PM -0400, D. Richard Hipp wrote: > UPDATE t1 SET x=x; -- key line: Is this considered an "update" > of t1.x? Igor pointed to the standards text, which I think is quite reasonable: an update is only an update if something changes. The same should probably

Re: [sqlite] SQL language question

2009-09-22 Thread Simon Slavin
On 22 Sep 2009, at 9:45pm, D. Richard Hipp wrote: > The question is this: Should the no-op UPDATE statement (x=x) cause > the ON UPDATE SET NULL foreign key constraint to set t2.y to NULL or > not? You would surely need agreement with the result of sqlite3_changes(), right ? CREATE TABLE

Re: [sqlite] SQL language question

2009-09-22 Thread Swithun Crowe
Hello DRH The question is this: Should the no-op UPDATE statement (x=x) cause DRH the ON UPDATE SET NULL foreign key constraint to set t2.y to NULL or DRH not? I think MySQL knows if a row gets actually updated. If the values in a row don't change, then it says that no rows were updated. I

Re: [sqlite] SQL language question

2009-09-22 Thread Igor Tandetnik
D. Richard Hipp wrote: > Consider the following SQL: > > CREATE TABLE t1(x integer); > INSERT INTO t1 VALUES(123); > CREATE TABLE t2(y integer REFERENCES t1 ON UPDATE SET NULL); > INSERT INTO t2 VALUES(123); > > UPDATE t1 SET x=x; -- key line: Is this

Re: [sqlite] SQL language question

2009-09-22 Thread Rich Shepard
On Tue, 22 Sep 2009, D. Richard Hipp wrote: > The question is this: Should the no-op UPDATE statement (x=x) cause the > ON UPDATE SET NULL foreign key constraint to set t2.y to NULL or not? > > PostgreSQL says "no" - the t2.y value is not nulled unless the t1.x > value really does change values.

[sqlite] SQL language question

2009-09-22 Thread D. Richard Hipp
Consider the following SQL: CREATE TABLE t1(x integer); INSERT INTO t1 VALUES(123); CREATE TABLE t2(y integer REFERENCES t1 ON UPDATE SET NULL); INSERT INTO t2 VALUES(123); UPDATE t1 SET x=x; -- key line: Is this considered an "update" of t1.x? SELECT * FROM