Skip to content

Don't allow dropping column if trigger referencing it #4029

@Pavan-Nambi

Description

@Pavan-Nambi

seed : 1155061234992720784

Use ".open FILENAME" to reopen on a persistent database
turso> CREATE TABLE t (
    n REAL
);

CREATE TABLE t1 (
    m TEXT,
    d REAL
);

CREATE TRIGGER trg
BEFORE DELETE ON t
BEGIN
    UPDATE t1
    SET m = 'x'
    WHERE m = 'y';
END;

ALTER TABLE t1 DROP COLUMN m;

sqlite:

sqlite> CREATE TABLE t (
    n REAL
);

CREATE TABLE t1 (
    m TEXT,
    d REAL
);

CREATE TRIGGER trg
BEFORE DELETE ON t
BEGIN
    UPDATE t1
    SET m = 'x'
    WHERE m = 'y';
END;

ALTER TABLE t1 DROP COLUMN m;
Runtime error: error in trigger trg after drop column: no such column: m
sqlite>

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions