ClickHouse-Net icon indicating copy to clipboard operation
ClickHouse-Net copied to clipboard

INSERT ... SETTINGS syntax does not work with bulk insertion

Open vphoenix1972 opened this issue 1 year ago • 0 comments

Description

I am trying to set query level settings with bulk insertion:

using var command = connection.CreateCommand();
            
command.CommandText =
@"insert into traffic
    (column1, column2, column3)
settings parallel_view_processing = true
values @bulk";

command.Parameters.Add(new ClickHouseParameter
{
    ParameterName = "bulk",
    Value = new MyBulkInsertObject(traffic)
});

command.ExecuteNonQuery();

But it returns with error:

ClickHouse.Ado.ClickHouseException: DB::ParsingException: Cannot parse input: expected '(' before: '\'val1\',\'val2\',\'val3\':  at row 0: While executing ValuesBlockInputFormat
2024-06-04 16:30:24    at ClickHouse.Ado.Impl.ProtocolFormatter.ReadAndThrowException(CancellationToken cToken)
2024-06-04 16:30:24    at ClickHouse.Ado.Impl.ProtocolFormatter.ReadPacket(Response rv, CancellationToken cToken)
2024-06-04 16:30:24    at ClickHouse.Ado.Impl.ProtocolFormatter.ReadResponse(CancellationToken cToken)
2024-06-04 16:30:24    at ClickHouse.Ado.ClickHouseCommand.Execute(Boolean readResponse, ClickHouseConnection connection, CancellationToken cToken)
2024-06-04 16:30:24    at ClickHouse.Ado.ClickHouseCommand.ExecuteNonQueryAsync(CancellationToken cToken)
2024-06-04 16:30:24    at ClickHouse.Ado.ClickHouseCommand.ExecuteNonQuery()

What should be done

It looks like a bug. Is 'INSERT ... SETTINGS' syntax supported with bulk insertion functionality?

v2.0.5 Clickhouse 23.11.3.23

vphoenix1972 avatar Jun 04 '24 13:06 vphoenix1972