Skip Menu |

This queue is for tickets about the SQL-Translator CPAN distribution.

Report information
The Basics
Id: 70734
Status: resolved
Priority: 0/
Queue: SQL-Translator

People
Owner: Nobody in particular
Requestors: FGA [...] cpan.org
Cc:
AdminCc:

Bug Information
Severity: (no value)
Broken in:
  • 0.11008
  • 0.11009
Fixed in: 0.11011



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 );
On Mon Sep 05 09:18:36 2011, FGA wrote: Show quoted text
> 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.
Hi, I have created a patch which adds support for cascaded actions to sqlite. It might solve your problems. Take a look at bug report No #71283 best regards,
On Tue, 27 Sep 2011 12:19:22 -0400, LUKAST wrote: Show quoted text
> On Mon Sep 05 09:18:36 2011, FGA wrote:
> > 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.
> > Hi, > > I have created a patch which adds support for cascaded actions to sqlite. > > It might solve your problems. Take a look at bug report No #71283 > > best regards,
I applied your patch on my local copy. No tests seem to break and the cascaded actions work now. I'll need to test this on a larger, more realistic project, but it looks like everything works. Thanks for the patch!