neisbut/Npgsql.Bulk

HiLo doesn't work

ptrushin opened this issue · 3 comments

When I use HiLo entity keys like

builder.HasSequence("EFHiLoSequence100").IncrementsBy(100);
builder.UseHiLo("EFHiLoSequence100");

Then I manually set keys massively
But when I try

uploader.Insert(entityList)

this will error

Npgsql.PostgresException (0x80004005): 23502: null value in column "id" violates not-null constraint
at Npgsql.NpgsqlConnector.<>c__DisplayClass160_0.<g__ReadMessageLong|0>d.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
at Npgsql.NpgsqlConnector.<>c__DisplayClass160_0.<g__ReadMessageLong|0>d.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
at Npgsql.NpgsqlDataReader.NextResult(Boolean async, Boolean isConsuming)
at Npgsql.NpgsqlDataReader.NextResult()
at Npgsql.NpgsqlCommand.ExecuteReaderAsync(CommandBehavior behavior, Boolean async, CancellationToken cancellationToken)
at Npgsql.NpgsqlCommand.ExecuteReader(CommandBehavior behavior)
at Npgsql.Bulk.NpgsqlBulkUploader.InsertPortion[T](IEnumerable1 list, List1 insertParts, NpgsqlConnection conn, NpgsqlBulkCodeBuilder1 codeBuilder, String tempTableName, Object ignoreDuplicatesStatement, InsertConflictAction onConflict) at Npgsql.Bulk.NpgsqlBulkUploader.Insert[T](IEnumerable1 entities, InsertConflictAction onConflict)
at Npgsql.Bulk.NpgsqlBulkUploader.Insert[T](IEnumerable`1 entities)

Hi @ptrushin , thanks for reporting this! I did some changes in 0.8.4 version to fix this. Could you please try it on your side?

In my case all is ok. Thanks!

Great! Thank you!