Skip to content

RMLTC0009c: reorder DROP TABLE statements for SQL resources for test repeatability #49

Open
@mcndt

Description

@mcndt

Currently, the test case RMLTC0009c drops a referenced table before dropping the table that registered the foreign key. When running this test twice in a row, this can result in an a foreign key exception in some RDBs.

I propose to reorder the SQL script such that this conflict cannot occur:

DROP TABLE IF EXISTS test.Student;  -- reordered
DROP TABLE IF EXISTS test.Sport;    -- reordered

CREATE TABLE Sport (
ID integer,
Name varchar (50),
PRIMARY KEY (ID)
);

CREATE TABLE Student (
ID integer,
Name varchar(50),
Sport integer,
PRIMARY KEY (ID),
FOREIGN KEY(Sport) REFERENCES Sport(ID)
);

INSERT INTO Sport (ID, Name) VALUES (100,'Tennis');
INSERT INTO Student (ID, Name, Sport) VALUES (10,'Venus Williams', 100);
INSERT INTO Student (ID, Name, Sport) VALUES (20,'Demi Moore', NULL);

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