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 with random column list #1992

Merged

Conversation

balazstbb
Copy link
Contributor

@balazstbb balazstbb commented Dec 7, 2022

The usage of useBulkCopyForBatchInsert=true connection parameter leads to invalid batch inserts.

Requirements of the problem:

  • useBulkCopyForBatchInsert connection parameter value is true
  • the statement and the data types are compatible with the useBulkCopyForBatchInsert requirements known-limitations
  • the columns provided in the insert in a different order then defined in the table schema

This PR contains a JUnit test
com.microsoft.sqlserver.jdbc.preparedStatement.BatchExecutionWithBulkCopyTest.testReverseColumnOrder()
that can be used to reproduce the problem.

This fix takes the column list order make sure the right values picked for the columns.

Issue: #1993

@balazstbb
Copy link
Contributor Author

@microsoft-github-policy-service agree

@lilgreenbird
Copy link
Contributor

/azp run CI-MacOS

@azure-pipelines
Copy link

Azure Pipelines successfully started running 1 pipeline(s).

@lilgreenbird
Copy link
Contributor

/azp run CI-MacOS

@azure-pipelines
Copy link

Azure Pipelines successfully started running 1 pipeline(s).

@tkyc
Copy link
Contributor

tkyc commented Dec 8, 2022

We'll take a look at the PR after we complete our hotfix releases. Thanks for the contribution.

@lilgreenbird lilgreenbird self-requested a review February 16, 2023 00:16
@lilgreenbird lilgreenbird added the Enhancement An enhancement to the driver. Lower priority than bugs. label Feb 16, 2023
@lilgreenbird lilgreenbird added this to the 12.3.0 milestone Feb 16, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Enhancement An enhancement to the driver. Lower priority than bugs.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Bulk Copy cannot handle inserts with subset or differently ordered columns
4 participants