You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I got below error when try to insert multiple values.
I am using postgresql , For primary key am using gen_random_uuid().
Npgsql.PostgresException
HResult=0x80004005
Message=23505: duplicate key value violates unique constraint "test_pkey"
DETAIL: Detail redacted as it may contain sensitive data. Specify 'Include Error Detail' in the connection string to include this information.
Source=Npgsql
StackTrace:
at Npgsql.Internal.NpgsqlConnector.d__233.MoveNext()
at System.Runtime.CompilerServices.PoolingAsyncValueTaskMethodBuilder1.StateMachineBox1.System.Threading.Tasks.Sources.IValueTaskSource.GetResult(Int16 token)
at Npgsql.NpgsqlDataReader.d__52.MoveNext()
at Npgsql.NpgsqlDataReader.d__52.MoveNext()
at Npgsql.NpgsqlDataReader.NextResult()
at Npgsql.NpgsqlCommand.d__119.MoveNext()
at Npgsql.NpgsqlCommand.d__119.MoveNext()
at System.Threading.Tasks.ValueTask1.get_Result() at Npgsql.NpgsqlCommand.ExecuteReader(CommandBehavior behavior) at Npgsql.Bulk.NpgsqlBulkUploader.InsertPortion[T](IEnumerable1 list, List1 insertParts, NpgsqlConnection conn, NpgsqlBulkCodeBuilder1 codeBuilder, String tempTableName, EntityInfo entityInfo, InsertConflictAction onConflict)
at Npgsql.Bulk.NpgsqlBulkUploader.Insert[T](IEnumerable1 entities, InsertConflictAction onConflict) at Npgsql.Bulk.NpgsqlBulkUploader.Insert[T](IEnumerable1 entities)
at TestBulkInsert.SqlBulkHandler.Insert[T](IEnumerable`1 entities) in C:\Users\TestBulkInsert\TestBulkInsert\SqlBulkHandler.cs:line 19
at Program.
$(String[] args) in C:\Users\TestBulkInsert\TestBulkInsert\Program.cs:line 125
The text was updated successfully, but these errors were encountered:
SivaTR
changed the title
duplicate key value violates unique constrain
Bulk insert issue with GUID primary key
Jun 26, 2024
I got below error when try to insert multiple values.
I am using postgresql , For primary key am using gen_random_uuid().
Npgsql.PostgresException
HResult=0x80004005
Message=23505: duplicate key value violates unique constraint "test_pkey"
DETAIL: Detail redacted as it may contain sensitive data. Specify 'Include Error Detail' in the connection string to include this information.
$(String[] args) in C:\Users\TestBulkInsert\TestBulkInsert\Program.cs:line 125Source=Npgsql
StackTrace:
at Npgsql.Internal.NpgsqlConnector.d__233.MoveNext()
at System.Runtime.CompilerServices.PoolingAsyncValueTaskMethodBuilder
1.StateMachineBox
1.System.Threading.Tasks.Sources.IValueTaskSource.GetResult(Int16 token)at Npgsql.NpgsqlDataReader.d__52.MoveNext()
at Npgsql.NpgsqlDataReader.d__52.MoveNext()
at Npgsql.NpgsqlDataReader.NextResult()
at Npgsql.NpgsqlCommand.d__119.MoveNext()
at Npgsql.NpgsqlCommand.d__119.MoveNext()
at System.Threading.Tasks.ValueTask
1.get_Result() at Npgsql.NpgsqlCommand.ExecuteReader(CommandBehavior behavior) at Npgsql.Bulk.NpgsqlBulkUploader.InsertPortion[T](IEnumerable
1 list, List1 insertParts, NpgsqlConnection conn, NpgsqlBulkCodeBuilder
1 codeBuilder, String tempTableName, EntityInfo entityInfo, InsertConflictAction onConflict)at Npgsql.Bulk.NpgsqlBulkUploader.Insert[T](IEnumerable
1 entities, InsertConflictAction onConflict) at Npgsql.Bulk.NpgsqlBulkUploader.Insert[T](IEnumerable
1 entities)at TestBulkInsert.SqlBulkHandler.Insert[T](IEnumerable`1 entities) in C:\Users\TestBulkInsert\TestBulkInsert\SqlBulkHandler.cs:line 19
at Program.
The text was updated successfully, but these errors were encountered: