mirror of
https://github.com/dolthub/dolt.git
synced 2026-02-25 18:28:57 -06:00
Add a variety of skipped bats tests (#4014)
This commit is contained in:
@@ -303,3 +303,23 @@ SQL
|
||||
[[ "${lines[1]}" =~ 'v1,int,YES,"",NULL,""' ]] || false
|
||||
[[ "${lines[2]}" =~ 'v2,int,YES,"",NULL,""' ]] || false
|
||||
}
|
||||
|
||||
@test "create-views: can correctly alter a view" {
|
||||
skip "ALTER VIEW is unsupported"
|
||||
dolt sql -q "create table t(pk int primary key, val int)"
|
||||
dolt sql -q "create view view1 as select * from t"
|
||||
|
||||
dolt sql -q "alter view view1 as select val from t"
|
||||
}
|
||||
|
||||
@test "create-views: views get properly formatted in the information schema table" {
|
||||
skip "views are not correctly formatted right now"
|
||||
dolt sql -q "create table t(pk int primary key, val int)"
|
||||
dolt sql -q "create view view1 as select pk from t"
|
||||
|
||||
DATABASE=$(dolt sql -r csv -q "SELECT DATABASE()" | sed -n 2p)
|
||||
run dolt sql -r csv -q "SELECT VIEW_DEFINITION FROM information_schema.views where TABLE_NAME='view1'"
|
||||
[ "$status" -eq 0 ]
|
||||
[[ "$output" =~ "VIEW_DEFINITION" ]] || false
|
||||
[[ "$output" =~ "select $DATABASE.t from $DATABASE.t" ]] || false
|
||||
}
|
||||
|
||||
@@ -1968,3 +1968,33 @@ SQL
|
||||
[[ ! "$output" =~ "panic:" ]] || false
|
||||
[[ "$output" =~ "cannot add or update a child row - Foreign key violation on fk: \`fk_b_a_id_refs_a\`, table: \`b\`, referenced table: \`a\`, key: \`[31337]\`" ]] || false
|
||||
}
|
||||
|
||||
@test "foreign-keys: partial updates work against foreign key constraints" {
|
||||
skip "Partial updates are unsupported"
|
||||
dolt sql <<SQL
|
||||
DROP TABLE IF EXISTS parent;
|
||||
DROP TABLE IF EXISTS child;
|
||||
CREATE TABLE parent(
|
||||
a int PRIMARY KEY
|
||||
);
|
||||
CREATE TABLE child (
|
||||
a int NOT NULL,
|
||||
b int DEFAULT NULL,
|
||||
c int DEFAULT NULL,
|
||||
PRIMARY KEY (a),
|
||||
KEY child_b (b),
|
||||
KEY child_c (c),
|
||||
CONSTRAINT child_ibfk_1 FOREIGN KEY (b) REFERENCES parent (a),
|
||||
CONSTRAINT child_ibfk_2 FOREIGN KEY (c) REFERENCES parent (a)
|
||||
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci;
|
||||
|
||||
INSERT INTO parent VALUES (1);
|
||||
|
||||
SET FOREIGN_KEY_CHECKS=0;
|
||||
INSERT INTO child values (100, 1, 1), (101, 2, 2);
|
||||
SET FOREIGN_KEY_CHECKS=1;
|
||||
SQL
|
||||
|
||||
run dolt sql -q "update child set b = 1 where a = 101;"
|
||||
[ "$status" -eq 0 ]
|
||||
}
|
||||
|
||||
@@ -1193,3 +1193,12 @@ SQL
|
||||
run dolt table import -u mytable x.csv
|
||||
[ $status -eq 0 ]
|
||||
}
|
||||
|
||||
@test "keyless: unique key should be represented as a primary key" {
|
||||
skip "unique key is created, but it should be described as a primary key."
|
||||
dolt sql -q "create table t(pk int not null auto_increment, UNIQUE KEY pk (pk));"
|
||||
|
||||
run dolt sql -r csv -q "describe t"
|
||||
[[ "$output" =~ "Field,Type,Null,Key,Default,Extra" ]] || false
|
||||
[[ "$output" =~ "ai,int,NO,UNI,NULL,auto_increment" ]] || false
|
||||
}
|
||||
|
||||
@@ -767,3 +767,12 @@ SQL
|
||||
[ "$status" -eq 1 ]
|
||||
[[ "$output" =~ "table not found: myTempTable" ]] || false
|
||||
}
|
||||
|
||||
@test "sql-create-tables: BINARY attributes" {
|
||||
dolt sql <<SQL
|
||||
CREATE TABLE budgets(id CHAR(36) CHARACTER SET utf8mb4 BINARY);
|
||||
CREATE TABLE budgets2(id CHAR(36) BINARY);
|
||||
SQL
|
||||
dolt sql -q "INSERT INTO budgets VALUES (UUID());"
|
||||
dolt sql -q "INSERT INTO budgets2 VALUES (UUID());"
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user