spanner: Properly handle multi-row mutations with heterogeneous columns#2426
spanner: Properly handle multi-row mutations with heterogeneous columns#2426stephenplusplus merged 4 commits intogoogleapis:masterfrom
Conversation
Prior to this change, attempting to insert multiple rows at once with Table#insert or Transaction#insert where some rows lack a value for nullable columns would result in data attempting to be inserted into the incorrect column, due to a flawed assumption in transaction-request.js that every single row contains exact same set of columns, and that the order of keys returned by Object.keys would be identical for each and every row. This fixes googleapis#2411.
|
So there's good news and bad news. 👍 The good news is that everyone that needs to sign a CLA (the pull request submitter and all commit authors) have done so. Everything is all good there. 😕 The bad news is that it appears that one or more commits were authored by someone other than the pull request submitter. We need to confirm that they're okay with their commits being contributed to this project. Please have them confirm that here in the pull request. Note to project maintainer: This is a terminal state, meaning the |
| BoolValue: true, | ||
| IntValue: 10 | ||
| } | ||
| ], done); |
This comment was marked as spam.
This comment was marked as spam.
Sorry, something went wrong.
This comment was marked as spam.
This comment was marked as spam.
Sorry, something went wrong.
This comment was marked as spam.
This comment was marked as spam.
Sorry, something went wrong.
This comment was marked as spam.
This comment was marked as spam.
Sorry, something went wrong.
This comment was marked as spam.
This comment was marked as spam.
Sorry, something went wrong.
This comment was marked as spam.
This comment was marked as spam.
Sorry, something went wrong.
|
What would happen if the two rows have different number of columns? I think you should error out in that case. |
| var missingColumns = columns.filter(column => keys.indexOf(column) === -1); | ||
|
|
||
| if (missingColumns.length > 0) { | ||
| throw new Error([ |
This comment was marked as spam.
This comment was marked as spam.
Sorry, something went wrong.
Co-authored-by: release-please[bot] <55107282+release-please[bot]@users.noreply.github.com>
Fixes #2411
This adds a commit with tests on top of the work done by @jscinoz in #2417.