2018-11-30 17:55:24 +00:00
|
|
|
#!/usr/bin/env bash
|
|
|
|
|
|
|
|
CURDIR=$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)
|
2020-12-28 11:46:53 +00:00
|
|
|
# shellcheck source=../shell_config.sh
|
2020-08-01 00:51:12 +00:00
|
|
|
. "$CURDIR"/../shell_config.sh
|
2018-11-30 17:55:24 +00:00
|
|
|
|
2020-09-03 23:28:44 +00:00
|
|
|
${CLICKHOUSE_CLIENT} --multiquery --mutations_sync=1 << EOF
|
2019-04-16 14:13:13 +00:00
|
|
|
DROP TABLE IF EXISTS mutations;
|
|
|
|
DROP TABLE IF EXISTS for_subquery;
|
2018-11-30 17:55:24 +00:00
|
|
|
|
|
|
|
CREATE TABLE mutations(x UInt32, y UInt32) ENGINE MergeTree ORDER BY x;
|
|
|
|
INSERT INTO mutations VALUES (123, 1), (234, 2), (345, 3);
|
|
|
|
|
|
|
|
CREATE TABLE for_subquery(x UInt32) ENGINE TinyLog;
|
|
|
|
INSERT INTO for_subquery VALUES (234), (345);
|
|
|
|
|
|
|
|
ALTER TABLE mutations UPDATE y = y + 1 WHERE x IN for_subquery;
|
|
|
|
ALTER TABLE mutations UPDATE y = y + 1 WHERE x IN (SELECT x FROM for_subquery);
|
|
|
|
EOF
|
|
|
|
|
2019-04-16 14:13:13 +00:00
|
|
|
${CLICKHOUSE_CLIENT} --query="SELECT * FROM mutations"
|
2018-11-30 17:55:24 +00:00
|
|
|
|
2019-04-16 14:13:13 +00:00
|
|
|
${CLICKHOUSE_CLIENT} --query="DROP TABLE mutations"
|
|
|
|
${CLICKHOUSE_CLIENT} --query="DROP TABLE for_subquery"
|