Re: [sqlite] Using foreign key reference on RowID

2010-11-18 Thread Bernard Ertl
Wow. Thanks. I see now that this is mentioned in the docs on the page for the VACUUM statement. It really should be mentioned on the CREATE TABLE page also where the rowid is explained. This is important information for people who are learning SQLite and trying to figure out how to design

Re: [sqlite] Using foreign key reference on RowID

2010-11-18 Thread Bernard Ertl
As someone who just started using SQLite without any previous background in SQL, it was confusing to me. I did a search on nabble through this mailing list and see now that I'm not the first person to ask about this issue. IMO, it would be helpful to people new to SQLite to mention this in the

Re: [sqlite] Using foreign key reference on RowID

2010-11-18 Thread Jay A. Kreibich
On Wed, Nov 17, 2010 at 04:36:12PM -0600, Bernard Ertl scratched on the wall: > Is it not possible to reference the SQLite > internal/default column for the RowID in a foreign key definition? Even if you could, you don't want to do this. Unless you define an ROWID alias (i.e. an INTEGER

Re: [sqlite] Using foreign key reference on RowID

2010-11-18 Thread Kees Nuyt
On Wed, 17 Nov 2010 16:36:12 -0600, "Bernard Ertl" wrote: >I'm getting a "foreign key mismatch" error with the following code: > >~~~ > >PRAGMA foreign_keys = ON; > >CREATE TABLE IF NOT EXISTS JobPlans (Name UNIQUE); > >CREATE TABLE IF NOT EXISTS Tasks (JobPlan_ID

[sqlite] Using foreign key reference on RowID

2010-11-18 Thread Bernard Ertl
I'm getting a "foreign key mismatch" error with the following code: ~~~ PRAGMA foreign_keys = ON; CREATE TABLE IF NOT EXISTS JobPlans (Name UNIQUE); CREATE TABLE IF NOT EXISTS Tasks (JobPlan_ID INTEGER NOT NULL REFERENCES JobPlans(RowID) ON DELETE CASCADE, UID UNIQUE NOT NULL); INSERT INTO