declare -a engines=("MergeTree order by n""ReplicatedMergeTree('/test/01162/$CLICKHOUSE_TEST_ZOOKEEPER_PREFIX', '1') order by n""Memory""Join(ALL, FULL, n)")
$CLICKHOUSE_CLIENT -q "CREATE OR REPLACE VIEW t1 AS SELECT number * 10 AS id, number * 100 AS value FROM numbers(20)"
$CLICKHOUSE_CLIENT -q "CREATE TABLE test ENGINE=$engine AS SELECT number + 100 AS n, 0 AS test FROM numbers(50)" 2>&1| grep -Ev "Removing leftovers from table|removed by another replica"
UPDATE test=(SELECT groupArray(id) FROM t1 GROUP BY 1)[n - 99] WHERE 1" 2>&1| grep -Fa "DB::Exception: " | grep -Fv "statement with subquery may be nondeterministic"
$CLICKHOUSE_CLIENT --allow_nondeterministic_mutations=1 --mutations_sync=1 -q "ALTER TABLE test
UPDATE test=(SELECT groupArray(id) FROM t1 GROUP BY 1)[n - 99] WHERE 1"
elif[[$engine== *"Join"* ]];then
$CLICKHOUSE_CLIENT -q "ALTER TABLE test
UPDATE test=(SELECT groupArray(id) FROM t1 GROUP BY 1)[n - 99] WHERE 1" 2>&1| grep -Fa "DB::Exception: " | grep -Fv "Table engine Join supports only DELETE mutations"
else
$CLICKHOUSE_CLIENT --mutations_sync=1 -q "ALTER TABLE test
UPDATE test=(SELECT groupArray(id) FROM t1 GROUP BY 1)[n - 99] WHERE 1"