Subject: | SQLite parser missing ON UPDATE/DELETE... |
The SQLite parser class does not support foreign key clauses such as ON
DELETE CASCADE, mentioned in the SQLite documentation (for instance
here: http://www.sqlite.org/syntaxdiagrams.html#foreign-key-clause).
Attached is an example of database that can be tested with:
$ sqlt --from SQLite --to GraphViz fails.sql > fails.png
This outputs:
ERROR (line 1): Invalid statement: Was expecting begin
transaction, or
commit, or drop, or comment, or create
Error: translate: Error with parser 'SQL::Translator::Parser::SQLite':
no results at /home/fgabolde/perl5/perlbrew/perls/perl-dev/bin/sqlt line
353.
If "ON DELETE CASCADE" is removed, the graph is correctly produced. This
is all running SQLite 3.7.5 and SQL::Translator 0.11009.
I'll take this opportunity to mention that SQL::Translator is a
seriously useful piece of software that has saved me a lot of work.
Thanks for the module.
Subject: | fails.sql |
CREATE TABLE foo (
id INTEGER PRIMARY KEY,
bar INTEGER REFERENCES bar(id) ON DELETE CASCADE
);
CREATE TABLE bar (
id INTEGER PRIMARY KEY
);