Re: [sqlite] foreign key the true error - sqlite 3.7.0.1

2010-08-09 Thread Oliver Peters
Igor Tandetnik writes: [...] > > Why would you want to fail statements that end up not violating any > constraints? The idea is to prevent that somebody can change the table staff that is not already in the table. Therefore I create the first user by not switching on foreign

Re: [sqlite] foreign key the true error - sqlite 3.7.0.1

2010-08-09 Thread Igor Tandetnik
Oliver Peters wrote: > Please believe me I really try hard to understand - but what I don't > understand > is the fact that you can insert in this case: > > > PRAGMA foreign_keys = ON; > > /* > **success INSERT = yes > */ > > CREATE TABLE a( >id

Re: [sqlite] foreign key the true error - sqlite 3.7.0.1

2010-08-09 Thread Oliver Peters
Dan Kennedy writes: > > > why returns the "INSERT INTO a" not an error while the "INSERT INTO > > b" does? How > > corresponds this behaviour to the concept of FOREIGN KEYS? > > > CREATE TABLE a( > >idINTEGER PRIMARY > >

Re: [sqlite] foreign key the true error - sqlite 3.7.0.1

2010-08-09 Thread Martin.Engelschalk
Am 09.08.2010 16:57, schrieb Oliver Peters: > [...] > > To my mind the simplified question is: > > why returns the "INSERT INTO a" not an error while the "INSERT INTO b" does? > How > corresponds this behaviour to the concept of FOREIGN KEYS? > > I wrote the code into file.sql (encoding=utf8,

Re: [sqlite] foreign key the true error - sqlite 3.7.0.1

2010-08-09 Thread Dan Kennedy
> why returns the "INSERT INTO a" not an error while the "INSERT INTO > b" does? How > corresponds this behaviour to the concept of FOREIGN KEYS? > CREATE TABLE a( >idINTEGER PRIMARY > KEY > AUTOINCREMENT, >id_staff_editor

Re: [sqlite] foreign key the true error - sqlite 3.7.0.1

2010-08-09 Thread Oliver Peters
[...] To my mind the simplified question is: why returns the "INSERT INTO a" not an error while the "INSERT INTO b" does? How corresponds this behaviour to the concept of FOREIGN KEYS? I wrote the code into file.sql (encoding=utf8, if this matters) and started sqlite3 -bail test.db3 <

Re: [sqlite] foreign key the true error - sqlite 3.7.0.1

2010-08-09 Thread Black, Michael (IS)
I found the (apparent) problem. This works and throws the constraint violation: PRAGMA foreign_keys=OFF; CREATE TABLE staff_01( id INTEGER PRIMARY KEY AUTOINCREMENT, id_staff_editor INTEGER NOT NULL, code CHAR(2) NOT NULL, FOREIGN KEY(id_staff_editor) REFERENCES staff(id) ); INSERT INTO

Re: [sqlite] foreign key the true error - sqlite 3.7.0.1

2010-08-09 Thread Oliver Peters
I use the standard windows binary from http://www.sqlite.org/sqlite-3_7_0_1.zip and if I do the recommended test I get >sqlite3 SQLite version 3.7.0.1 Enter ".help" for instructions Enter SQL statements terminated with a ";" sqlite> pragma foreign_keys; 0 sqlite> pragma foreign_keys=ON; sqlite>

Re: [sqlite] foreign key the true error - sqlite 3.7.0.1

2010-08-09 Thread Simon Davies
On 9 August 2010 14:56, Black, Michael (IS) wrote: > From http://www.sqlite.org/foreignkeys.html > > > > Although I believe I compiled my shell WITHOUT these defined but I still > don't get enforcement of the foreign key constraint. > > It appears that foreign keys are

Re: [sqlite] foreign key the true error - sqlite 3.7.0.1

2010-08-09 Thread Black, Michael (IS)
>From http://www.sqlite.org/foreignkeys.html Although I believe I compiled my shell WITHOUT these defined but I still don't get enforcement of the foreign key constraint. It appears that foreign keys are fully constrained by default. Is there any way in the shell to find out if it's

Re: [sqlite] foreign key the true error - sqlite 3.7.0.1

2010-08-09 Thread Oliver Peters
Igor Tandetnik writes: > > Oliver Peters wrote: > > This sql code works in the two cases but AFAIK it shouldn't in the second > > > > PRAGMA foreign_keys = ON; > > > > CREATE TABLE staff_02( > > idINTEGER PRIMARY KEY

Re: [sqlite] foreign key the true error - sqlite 3.7.0.1

2010-08-09 Thread Igor Tandetnik
Oliver Peters wrote: > This sql code works in the two cases but AFAIK ;-) it shouldn't in the second > > PRAGMA foreign_keys = ON; > > CREATE TABLE staff_02( > idINTEGER PRIMARY KEY AUTOINCREMENT, > id_staff_editor INTEGER

Re: [sqlite] foreign key the true error - sqlite 3.7.0.1

2010-08-09 Thread Oliver Peters
and the added , after UNIQUE(code) doesn't change anything (oh what a day ;-) ) Oliver ___ sqlite-users mailing list sqlite-users@sqlite.org http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users