On 08/12/2013 01:20 PM, Baruch Burstein wrote:
 From the documentation for CREATE TABLE:

     The parent key of a foreign key constraint is not allowed to use the
rowid. The parent key must used named columns only.

Does this mean it can or can't use a named column that is an alias for the
rowid? Is the problem using the rowid, or is the problem that if the rowid
is unaliased, it can change?

An INTEGER PRIMARY KEY can be a parent key:

  SQLite version 3.7.17 2013-05-17 12:52:58
  Enter ".help" for instructions
  Enter SQL statements terminated with a ";"
  sqlite> PRAGMA foreign_keys = on;
  sqlite> CREATE TABLE parent(a INTEGER PRIMARY KEY);
  sqlite> CREATE TABLE child(b REFERENCES parent);
  sqlite> INSERT INTO parent VALUES(13);
  sqlite> INSERT INTO child VALUES(13);
  sqlite> INSERT INTO child VALUES(15);
  Error: foreign key constraint failed


_______________________________________________
sqlite-users mailing list
sqlite-users@sqlite.org
http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users

Reply via email to