Octonica / ClickHouseClient

ClickHouse .NET Core driver
Apache License 2.0
138 stars 23 forks source link

Mutations Error #48

Open Genuineh opened 2 years ago

Genuineh commented 2 years ago

Hi, i got error when i use mutations operation delete like

using var cnn = new ClickHouseConnection(settings.ToString());

await cnn.OpenAsync().ConfigureAwait(false);

using var cmd = cnn.CreateCommand("INSERT INTO cktest SELECT @id, @name, 1");

cmd.Parameters.AddWithValue("id", 1);
cmd.Parameters.AddWithValue("name", "ok");

var text = cmd.CommandText;

var res = await cmd.ExecuteNonQueryAsync().ConfigureAwait(false);

using var cmd2 = cnn.CreateCommand("ALTER TABLE cktest delete WHERE id=@id");

cmd2.Parameters.AddWithValue("id", 1);

res = await cmd2.ExecuteNonQueryAsync().ConfigureAwait(false);

Error

Data still exist after i run detele code and I found mutations logs use "SELECT database,table, command, create_time, is_done FROM system.mutations LIMIT 10" , I got result like

database table command create_time is_done
default cktest DELETE WHERE id = (SELECT _d18374be9ae14385a55461be204f5a71.id FROM _d18374be9ae14385a55461be204f5a71) 2022-03-20 17:17:45 0

the operation blocked and it may be because the error command

I got right result when i run "ALTER TABLE cktest DELETE WHERE id=1" in cli

The mutations logs like database table command create_time is_done
default cktest DELETE WHERE id = 1 2022-03-20 17:18:25 1

Clickhouse Server Version: v22.2.3.5