Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Bulk insert issue with GUID primary key #86

Open
SivaTR opened this issue Jun 26, 2024 · 0 comments
Open

Bulk insert issue with GUID primary key #86

SivaTR opened this issue Jun 26, 2024 · 0 comments

Comments

@SivaTR
Copy link

SivaTR commented 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.
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

@SivaTR SivaTR changed the title duplicate key value violates unique constrain Bulk insert issue with GUID primary key Jun 26, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant