Skip to content

Insert record fails with foreign key constraint #601

@mtissington

Description

@mtissington

I have the following schema .. when I click the add record button, I get an error that it failed with foreign key constraint -

Why does the add record need to do a real INSERT before I have had a chance to edit the row?
(that's what the sql log is showing) ... this will never work.

BEGIN TRANSACTION;
CREATE TABLE "words" (
    `groupid`   INTEGER NOT NULL DEFAULT 1,
    `word`  TEXT NOT NULL,
    `action`    TEXT NOT NULL,
    PRIMARY KEY(groupid,word),
    FOREIGN KEY(`groupid`) REFERENCES `groups`(`groupid`) ON DELETE CASCADE
);
CREATE TABLE "groups" (
    `groupid`   INTEGER NOT NULL,
    `name`  TEXT NOT NULL,
    `description`   TEXT,
    `enabled`   INTEGER NOT NULL DEFAULT 1,
    `canedit`   INTEGER NOT NULL DEFAULT 1,
    PRIMARY KEY(groupid)
);
COMMIT;`

Metadata

Metadata

Assignees

Labels

bugConfirmed bugs or reports that are very likely to be bugs.constraints & foreign keys

Type

No type

Projects

No projects

Relationships

None yet

Development

No branches or pull requests

Issue actions