Skip to content

CASCADE DELETE doesn't work #3810

@domenkozar

Description

@domenkozar

CASCADE DELETE in turso v0.3.0-pre.4

Issue

CASCADE actions fail during INSERT with error:

Parse error: foreign key actions other than NO ACTION are not implemented

Steps

  1. Create table with ON DELETE CASCADE
  2. Enable PRAGMA foreign_keys = ON
  3. Try to INSERT data
  4. INSERT fails with error above

Code

conn.execute("PRAGMA foreign_keys = ON", ()).await?;

conn.execute("CREATE TABLE parent (id INTEGER PRIMARY KEY, name TEXT)", ()).await?;

conn.execute(
    "CREATE TABLE child (
        id INTEGER PRIMARY KEY,
        parent_id INTEGER NOT NULL,
        FOREIGN KEY (parent_id) REFERENCES parent(id) ON DELETE CASCADE
    )",
    ()
).await?;  // ✓ Succeeds

conn.execute("INSERT INTO parent (id, name) VALUES (1, 'test')", ()).await?;
// ❌ Fails: Parse error: foreign key actions other than NO ACTION are not implemented

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions