Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
mcndt opened this issue Jul 5, 2021 · 0 comments

Comments

@mcndt
Copy link

mcndt commented Jul 5, 2021

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);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant