Skip to content

BulkCopy writes binary data to String column incorrectly in 0.9 #109

@MaceWindu

Description

@MaceWindu

Describe the bug

        using var cn = new ClickHouseConnection(cs);
        cn.Open();

        using var cmd = cn.CreateCommand();

        cmd.CommandText = @"DROP TABLE IF EXISTS TestTable";
        cmd.ExecuteNonQuery();

        cmd.CommandText = @"
CREATE TABLE TestTable
(
	ID                Int32,
	StringValue       Nullable(String),
	FixedStringValue  Nullable(FixedString(20)),
) ENGINE = MergeTree() ORDER BY ID PRIMARY KEY ID
";
        cmd.ExecuteNonQuery();

        using var bc = new ClickHouseBulkCopy(cn)
        {
            DestinationTableName = "TestTable",
            ColumnNames = ["ID", "StringValue", "FixedStringValue"]
        };

        await bc.InitAsync();

        await bc.WriteToServerAsync([[1, new byte[] { 2 }, Enumerable.Range(0, 20).Select(r => (byte)r).ToArray()], [2, "123", "12345678901234567890"]]);
Image

Configuration

Environment

  • Client version: 0.9

ClickHouse server

  • ClickHouse Server version: 25.11

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions