Skip to content

CASCADE not supported (sqlite)  #897

Closed

Description

@sacesare

I've following table in sqlite [TEMP_COMMODITY_UUIDS]:

CREATE TABLE TEMP_COMMODITY_UUIDS (
    ID           INTEGER NOT NULL
                         PRIMARY KEY AUTOINCREMENT
                         REFERENCES COMMODITY (ID) ON DELETE CASCADE,
    UUID         TEXT    NOT NULL,
    BACKEND_UUID TEXT
);

When I try to execute in browser:

alasql([
'ATTACH SQLITE DATABASE db("test.dat");
USE db;
select * from TEMP_COMMODITY_UUIDS'
]).then(function(res){
     console.log("test:",res.pop());
});

I got:

> Uncaught SyntaxError: Parse error on line 1:
...ES COMMODITY(ID) ON DELETE CASCADE, [UUI
-----------------------^
Expecting 'UPDATE', got 'DELETE'
    at Parser.parser.parseError (alasql.js:2210)
    at Parser.parse (alasql.js:2084)
    at Function.alasql.parse (alasql.js:4396)
    at alasql.js:17141
    at Array.forEach (<anonymous>)
    at alasql.js:17138

It seems, alasql.js (0.4.0) can't understand 'ON DELETE CASCADE' construction of sqlite.
Similar query, using sql.js directly work just right.

Thanks.

Activity

  1. changed the title [-]sqlite table: Expecting 'UPDATE', got 'DELETE'[/-] [+]CASCADE not supported (sqlite) [/+] on Jun 30, 2017
  2. mathiasrw commented on Jun 30, 2017

    @mathiasrw
    Member

    Great input! thanks for taking the time to describe.

    Handling CASCADE is not implemented at the moment. Ill set it as a feature request!

  3. ChristopherHButler commented on Jul 20, 2022

    @ChristopherHButler

    It seems CASCADE is still not supported in 2022. Is there any plans for this in the near future?
    Thanks!

  4. mathiasrw commented on Sep 25, 2022

    @mathiasrw
    Member

    @ChristopherHButler We are happy to look at any pull request with this. I have not heard of any people working on this now.

  5. added a commit that references this issue on Dec 12, 2025
    299b3f5
  6. mathiasrw commented on Dec 13, 2025

    @mathiasrw
    Member

    We made sure the parser does not throw an error as part of v4.12.0 but its not executing cascade functinoality.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions