Howard Lowndes <[EMAIL PROTECTED]> wrote:
> I'm playing about with the following syntax:
>
> CREATE TABLE atable (
> a_ref integer
> not null
> primary key autoincrement,
> a_text text
> );
>
> CREATE TABLE btable (
> b_ref integer
> not null
> primary key autoincrement,
> b_text text,
> a_ref integer
> not null
> default 0
> references atable (a_ref)
> on delete set default
> on update cascade
> );
Be aware that SQLite silently ignores REFERENCES clause (together with
on delete, on update parts). You will have to create triggers to enforce
these constraints.
> Have I misunderstood the syntax for the SQL REFERENCES statement, or
> is the following from 2003 (??) still applicable:
>
> "That's not a legal FOREIGN KEY clause; you have to specify what the
> foreign key references. SQLite parses, but does not enforce,
> syntactically-legal FOREIGN KEY specifications; there's a PRAGMA that
> will retrieve foreign-key information from table definitions, allowing
> you to enforce such constraints with application code." which is in
> http://www.sqlite.org/cvstrac/wiki?p=UnsupportedSql
Still applicable.
Igor Tandetnik
___
sqlite-users mailing list
sqlite-users@sqlite.org
http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users