Skip to content

Fix Oracle bulk insert schema qualification issues#97

Closed
DPschichholz wants to merge 2 commits into
PhenX:mainfrom
DPschichholz:main
Closed

Fix Oracle bulk insert schema qualification issues#97
DPschichholz wants to merge 2 commits into
PhenX:mainfrom
DPschichholz:main

Conversation

@DPschichholz
Copy link
Copy Markdown
Contributor

@DPschichholz DPschichholz commented May 7, 2026

Fix Oracle bulk insert ORA-39831 when EF Core default schema is configured

  • Fix double-schema qualification when EF Core default schema is configured
  • Clarify table name handling comment
  • Add OpenTelemetry instrumentation project and update README

Details

When HasDefaultSchema(...) is set, tableInfo.QuotedTableName becomes a SQL-quoted fully qualified identifier (e.g. "SchemaX"."TableA"). Passing this to OracleBulkCopy.DestinationTableName causes ODP.NET to double-apply the schema, producing SchemaX.SchemaX.TableA and failing with ORA-39831.

Change

  • OracleBulkInsertProvider.BulkInsert: compute destinationTableName before assigning to bulkCopy.DestinationTableName:
    • Direct insert path (tableName == tableInfo.QuotedTableName): use tableInfo.TableName (plain unquoted name — ODP.NET resolves the schema itself)
    • Temp table path: use tableName unchanged
var destinationTableName = tableName == tableInfo.QuotedTableName
    ? tableInfo.TableName
    : tableName;

bulkCopy.DestinationTableName = destinationTableName;

- Fix double-schema qualification when EF Core default schema is configured
- Clarify table name handling comment
@DPschichholz DPschichholz marked this pull request as ready for review May 7, 2026 08:25
@DPschichholz DPschichholz requested a review from PhenX as a code owner May 7, 2026 08:25
@SebastianStehle
Copy link
Copy Markdown
Collaborator

I cant speak for Oracle.

But is the whole Trace stuff not part of .NET itselt? Something like ActivitySource? And where is it actually used? I don't see it. In general I am big fan of it, but I would make a seperate PR.

@PhenX
Copy link
Copy Markdown
Owner

PhenX commented May 16, 2026

@DPschichholz thank you for your contribution, but I agree with @SebastianStehle : while I like the idea to publish an OpenTelemetry integration, I'd like it to be in another pull request, and with another name as, first, I think we can't publish a Nuget packahe with this prefix, and second, that it should share the same prefix as the other packages, so : PhenX.EntityFrameworkCore.BulkInsert.OpenTelemetry, but in another pull request, it will require more effort than the single fix for Oracle to be validated.

Copy link
Copy Markdown
Owner

@PhenX PhenX left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please make another pull request for the open telemetry feature

@DPschichholz
Copy link
Copy Markdown
Contributor Author

I cant speak for Oracle.

But is the whole Trace stuff not part of .NET itselt? Something like ActivitySource? And where is it actually used? I don't see it. In general I am big fan of it, but I would make a seperate PR.

The telemetry integration is optional and can be enabled via .AddPhenXEntityFrameworkCoreBulkInsertInstrumentation() in projects using PhenX.EntityFrameworkCore.BulkInsert.
This hooks into the existing .NET tracing infrastructure and enables built-in telemetry for bulk insert operations.

@DPschichholz
Copy link
Copy Markdown
Contributor Author

The PR is splitted in #101 and #102

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

Successfully merging this pull request may close these issues.

3 participants