Commit 153985c
committed
Reverse order of values when upserting
I contributed two tests to Rails because I was not sure how `insert_all` and `upsert_all` should behave with duplicate identifiers.
For `insert_all`, all DBMS only insert the first value. For `upsert_all`, PostgreSQL throws an error in this scenario, but with sqlite and MySQL, the last entry ends up in the database.
For now, I do not have a smarter idea than reversing the `inserts`, which ultimately provide the `values_list`. Adding `MAX` would be another, but I fear the SQL query would get much more complicated.1 parent 2e23939 commit 153985c
File tree
1 file changed
+2
-0
lines changed- lib/active_record/connection_adapters/sqlserver
1 file changed
+2
-0
lines changedLines changed: 2 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
169 | 169 | | |
170 | 170 | | |
171 | 171 | | |
| 172 | + | |
| 173 | + | |
172 | 174 | | |
173 | 175 | | |
174 | 176 | | |
| |||
0 commit comments