mirror of
https://github.com/ClickHouse/ClickHouse.git
synced 2024-11-22 07:31:57 +00:00
Check if the mutation query is valid.
This commit is contained in:
parent
e29c488b05
commit
b229fb1664
@ -1386,6 +1386,9 @@ void MutationsInterpreter::validate()
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Make sure the mutations query is valid
|
||||||
|
prepareQueryAffectedQueryTree(commands, source.getStorage(), context);
|
||||||
|
|
||||||
QueryPlan plan;
|
QueryPlan plan;
|
||||||
|
|
||||||
initQueryPlan(stages.front(), plan);
|
initQueryPlan(stages.front(), plan);
|
||||||
|
19
tests/queries/0_stateless/03256_invalid_mutation_query.sql
Normal file
19
tests/queries/0_stateless/03256_invalid_mutation_query.sql
Normal file
@ -0,0 +1,19 @@
|
|||||||
|
DROP TABLE IF EXISTS t;
|
||||||
|
DROP TABLE IF EXISTS t2;
|
||||||
|
|
||||||
|
CREATE TABLE t (x int) ENGINE = MergeTree() ORDER BY ();
|
||||||
|
|
||||||
|
DELETE FROM t WHERE y in (SELECT y FROM t); -- { serverError 47 }
|
||||||
|
DELETE FROM t WHERE x in (SELECT y FROM t); -- { serverError 47 }
|
||||||
|
DELETE FROM t WHERE x IN (SELECT * FROM t2); -- { serverError 60 }
|
||||||
|
ALTER TABLE t DELETE WHERE x in (SELECT y FROM t); -- { serverError 47 }
|
||||||
|
ALTER TABLE t UPDATE x = 1 WHERE x IN (SELECT y FROM t); -- { serverError 47 }
|
||||||
|
|
||||||
|
ALTER TABLE t ADD COLUMN y int;
|
||||||
|
DELETE FROM t WHERE y in (SELECT y FROM t);
|
||||||
|
|
||||||
|
CREATE TABLE t2 (x int) ENGINE = MergeTree() ORDER BY ();
|
||||||
|
DELETE FROM t WHERE x IN (SELECT * FROM t2);
|
||||||
|
|
||||||
|
DROP TABLE t;
|
||||||
|
DROP TABLE t2;
|
Loading…
Reference in New Issue
Block a user