Skip to content

22P03: incorrect binary data format #56

@joelnotified

Description

@joelnotified

I'm using Z.EntityFramework.Extensions" Version="3.12.27 with Postgresql.

I load 100 entities from the database, and update properties on some of them, then I do a BulkSaveChangesAsync. I get the following error:

22P03: incorrect binary data format

Stacktrace:

   at Npgsql.NpgsqlConnector.<DoReadMessage>d__148.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
   at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
   at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
   at System.Runtime.CompilerServices.ValueTaskAwaiter`1.GetResult()
   at Npgsql.NpgsqlConnector.<ReadMessage>d__147.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
   at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
   at Npgsql.NpgsqlConnector.<ReadMessage>d__147.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
   at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
   at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
   at System.Runtime.CompilerServices.ValueTaskAwaiter`1.GetResult()
   at Npgsql.NpgsqlConnector.<ReadExpecting>d__154`1.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
   at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
   at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
   at Npgsql.NpgsqlBinaryImporter.Close()
   at �.�.�(Int32 �, DbTransaction �, ExecuteAction �, PostgreSqlActionExecutor �, DbConnection )
   at Z.BulkOperations.PostgreSqlActionExecutor.�(ExecuteAction )
   at Z.BulkOperations.PostgreSqlActionExecutor.�(ExecuteAction )
   at Z.BulkOperations.DbActionExecutor.�(List`1 )
   at Z.BulkOperations.PostgreSqlProvider.�(List`1 )
   at �.�.�(BulkOperation )
   at Z.BulkOperations.BulkOperation.BulkUpdate()
   at Z.EntityFramework.Extensions.SqlServerBulkSaveChanges.�(List`1 , Object , Dictionary`2 )
   at Z.EntityFramework.Extensions.SqlServerBulkSaveChanges.�()

This is the data field of the exception (if that helps):

-		Data	Count = 8	System.Collections.IDictionary {System.Collections.Generic.Dictionary<string, object>}
+		[0]	{[Severity, ERROR]}	System.Collections.Generic.KeyValuePair<string, object>
+		[1]	{[SqlState, 22P03]}	System.Collections.Generic.KeyValuePair<string, object>
+		[2]	{[Code, 22P03]}	System.Collections.Generic.KeyValuePair<string, object>
+		[3]	{[MessageText, incorrect binary data format]}	System.Collections.Generic.KeyValuePair<string, object>
+		[4]	{[Where, COPY zzzprojects_973b718c_8d26_4bb3_a261_38dc26535b8d, line 1, column zzzpredicate_7]}	System.Collections.Generic.KeyValuePair<string, object>
+		[5]	{[File, copy.c]}	System.Collections.Generic.KeyValuePair<string, object>
+		[6]	{[Line, 4153]}	System.Collections.Generic.KeyValuePair<string, object>
+		[7]	{[Routine, CopyReadBinaryAttribute]}	System.Collections.Generic.KeyValuePair<string, object>

Here is some pseudo code of what I'm doing:

var items = _dataContext
    .Items
    .Take(100)
    .ToList();

var filteredItems = items.Where(someCondition).ToList();

foreach (var item in filteredItems)
{
    item.property1 = updatedValue1;
    item.property2 = updatedValue2;
}

await _dataContext.BulkSaveChangesAsync();

Do you have an idea of what the problem could be? When using the standard EF6 SaveChangesAsync() everything works fine.

Metadata

Metadata

Labels

No labels
No labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions