CockroachDB (Bulk)

This page contains the latest information of the releases of RepoDb.CockroachDb.BulkOperations library.

View the NuGet package here or download it directly here.

RepoDb.CockroachDb.BulkOperations (v0.0.1-alpha1) - Preview

Released: September 26, 2026

New

First (alpha) release of the bulk operations extension for RepoDb.CockroachDb, built on CockroachDbBulkCopy, a native binary COPY-based bulk writer from RepoDb.Connector.CockroachDb.

What’s included

  • BulkInsert, BulkMerge, BulkUpdate, BulkDelete, and BulkDeleteByKey, each with an Async overload — callable against a CockroachDbConnection, a BaseRepository<TEntity, CockroachDbConnection>, or a DbRepository<CockroachDbConnection>, with an entity list, a DataTable, or an IDataReader (BulkDeleteByKey takes a list of primary key values instead).
  • CockroachDbBulkImportIdentityBehavior (KeepIdentity default, ReturnIdentity) — controls whether identity values are sent as-is or read back via a RETURNING clause.
  • CockroachDbBulkImportPseudoTableType (Auto, Memory, Physical) — selects the staging-table strategy. Unlike some other providers’ equivalent enum, Auto genuinely implements its row-count heuristic here: Physical at 5,000 rows or more, Memory below that.
  • CockroachDbBulkInsertMapItem — explicit source-to-destination column mapping for BulkInsert/BulkMerge/BulkUpdate, with an optional CockroachDbType override per mapping, and up-front type-compatibility checking.
  • CockroachDbTraceKeys — the traceKey constants for use with a custom ITrace.
  • A BulkMerge with identityBehavior: ReturnIdentity pre-assigns identities for the rows that will be inserted (nextval(pg_get_serial_sequence(...))) and then performs the whole upsert — matched and unmatched rows alike — through a single INSERT ... OVERRIDING SYSTEM VALUE ... ON CONFLICT DO UPDATE ... RETURNING statement, rather than the multi-statement snapshot/update/insert sequence some other providers require for the same feature.
  • An internal type-coercing data reader converts every mapped value to its destination column’s actual CLR type before it reaches CockroachDbBulkCopy — CockroachDB’s INT/INTEGER is a 64-bit INT8, and Npgsql’s binary COPY otherwise infers a 4-byte INT4 from a plain .NET int, which CockroachDB rejects.
  • Referenced the RepoDb package v1.17.0-alpha2.
  • Referenced the RepoDb.CockroachDb package v0.0.1-alpha1.
  • References the RepoDb.Connector.CockroachDb package v0.0.1-alpha1.

Known limitations (v1)

  • RepoDb.Connector.CockroachDb is an independent, unofficial ADO.NET provider for CockroachDB (a thin wrapper over Npgsql) — not affiliated with or endorsed by Cockroach Labs, and still in early development.
  • Requesting CockroachDbBulkImportPseudoTableType.Memory runs SET experimental_enable_temp_tables = 'on'; first — CockroachDB only supports temporary tables experimentally.
  • Every bulk call creates its own pseudo table and drops it once the call completes, rather than reusing one across calls.
  • No Unspecified identity-behavior state — CockroachDbBulkImportIdentityBehavior defaults straight to KeepIdentity.