Commit 9667b2d
committed
Fix KeyError in insert_all when pk column is missing from a single record
When a pk= column was named that isn't present in the data (and so isn't
created on the table), inserting exactly one record raised a KeyError while
inserting any other number of records did not. The single-record branch that
populates last_pk read the column straight out of the inserted row.
Check that the named pk column(s) actually exist on the row first and fall
back to the rowid otherwise, matching the behaviour for multiple records.
Closes #7321 parent 8f0c06e commit 9667b2d
2 files changed
Lines changed: 29 additions & 5 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
3608 | 3608 | | |
3609 | 3609 | | |
3610 | 3610 | | |
3611 | | - | |
3612 | | - | |
3613 | | - | |
3614 | | - | |
| 3611 | + | |
| 3612 | + | |
| 3613 | + | |
| 3614 | + | |
| 3615 | + | |
| 3616 | + | |
| 3617 | + | |
| 3618 | + | |
| 3619 | + | |
| 3620 | + | |
3615 | 3621 | | |
3616 | | - | |
| 3622 | + | |
| 3623 | + | |
| 3624 | + | |
3617 | 3625 | | |
3618 | 3626 | | |
3619 | 3627 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
670 | 670 | | |
671 | 671 | | |
672 | 672 | | |
| 673 | + | |
| 674 | + | |
| 675 | + | |
| 676 | + | |
| 677 | + | |
| 678 | + | |
| 679 | + | |
| 680 | + | |
| 681 | + | |
| 682 | + | |
| 683 | + | |
| 684 | + | |
| 685 | + | |
| 686 | + | |
| 687 | + | |
| 688 | + | |
673 | 689 | | |
674 | 690 | | |
675 | 691 | | |
| |||
0 commit comments