From 377a41935d541f4673fcf31982e222f55ac11190 Mon Sep 17 00:00:00 2001 From: Andrew Kane Date: Tue, 5 Mar 2024 21:54:39 -0800 Subject: [PATCH] Added test for binary copy --- tests/Pgvector.CSharp.Tests/NpgsqlTests.cs | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/tests/Pgvector.CSharp.Tests/NpgsqlTests.cs b/tests/Pgvector.CSharp.Tests/NpgsqlTests.cs index 69bc6af..dfbb9f7 100644 --- a/tests/Pgvector.CSharp.Tests/NpgsqlTests.cs +++ b/tests/Pgvector.CSharp.Tests/NpgsqlTests.cs @@ -69,6 +69,20 @@ public async Task Main() await cmd.ExecuteNonQueryAsync(); } + await using (var writer = conn.BeginBinaryImport("COPY items (embedding) FROM STDIN WITH (FORMAT BINARY)")) + { + writer.StartRow(); + writer.Write(new Vector(new float[] { 1, 1, 1 })); + + writer.StartRow(); + writer.Write(new Vector(new float[] { 2, 2, 2 })); + + writer.StartRow(); + writer.Write(new Vector(new float[] { 1, 1, 2 })); + + writer.Complete(); + } + await using (var cmd = new NpgsqlCommand("SELECT $1", conn)) { var embedding = new Vector(new float[16000]);