mirror of
https://github.com/tursodatabase/libsql.git
synced 2024-12-12 14:23:38 +00:00
ad79ef48a2
* add tests * add bench
67 lines
1.3 KiB
Plaintext
67 lines
1.3 KiB
Plaintext
PRAGMA foreign_keys = ON
|
|
|
|
CREATE TABLE pp(x PRIMARY KEY);
|
|
CREATE TABLE cc(y REFERENCES pp DEFERRABLE INITIALLY DEFERRED);
|
|
INSERT INTO pp VALUES('abc');
|
|
INSERT INTO cc VALUES('abc');
|
|
|
|
|
|
BEGIN;
|
|
DROP TABLE pp;
|
|
DROP TABLE cc;
|
|
COMMIT;
|
|
|
|
|
|
CREATE TABLE pp(x PRIMARY KEY);
|
|
CREATE TABLE cc(y REFERENCES pp DEFERRABLE INITIALLY DEFERRED);
|
|
INSERT INTO pp VALUES('abc');
|
|
INSERT INTO cc VALUES('abc');
|
|
|
|
|
|
BEGIN;
|
|
DROP TABLE cc;
|
|
DROP TABLE pp;
|
|
COMMIT;
|
|
|
|
|
|
CREATE TABLE pp(x PRIMARY KEY);
|
|
CREATE TABLE cc(
|
|
y INTEGER PRIMARY KEY REFERENCES pp DEFERRABLE INITIALLY DEFERRED
|
|
);
|
|
INSERT INTO pp VALUES(5);
|
|
INSERT INTO cc VALUES(5);
|
|
|
|
|
|
BEGIN;
|
|
DROP TABLE pp;
|
|
DROP TABLE cc;
|
|
COMMIT;
|
|
|
|
|
|
CREATE TABLE pp(x PRIMARY KEY);
|
|
CREATE TABLE cc(
|
|
y INTEGER PRIMARY KEY REFERENCES pp DEFERRABLE INITIALLY DEFERRED
|
|
);
|
|
INSERT INTO pp VALUES(5);
|
|
INSERT INTO cc VALUES(5);
|
|
|
|
|
|
BEGIN;
|
|
DROP TABLE cc;
|
|
DROP TABLE pp;
|
|
COMMIT;
|
|
|
|
|
|
CREATE TABLE pp1(x PRIMARY KEY);
|
|
CREATE TABLE cc1(y REFERENCES pp1 DEFERRABLE INITIALLY DEFERRED);
|
|
|
|
CREATE TABLE pp2(x PRIMARY KEY);
|
|
CREATE TABLE cc2(y REFERENCES pp1 DEFERRABLE INITIALLY DEFERRED);
|
|
|
|
INSERT INTO pp1 VALUES(2200);
|
|
INSERT INTO cc1 VALUES(NULL);
|
|
|
|
INSERT INTO pp2 VALUES(2200);
|
|
INSERT INTO cc2 VALUES(2200);
|
|
|