Commit 2fdf5bf
committed
mysql: keep REPLACE INTO when generating a :copyfrom LOAD DATA
A :copyfrom query written as REPLACE INTO generated
LOAD DATA LOCAL INFILE '%s' INTO TABLE ..., dropping the REPLACE.
MySQL's default for LOAD DATA is to skip rows that collide on a
primary or unique key, so the upsert the query asked for silently
became a skip.
The parser already reports it (marino ast.InsertStmt.IsReplace), but
nothing read the bit. Carry it on ast.InsertStmt, derive it from the
raw statement in the compiler, add it to plugin.Query, and emit
REPLACE INTO TABLE from the template.
Fixes #43391 parent 8a7cddf commit 2fdf5bf
15 files changed
Lines changed: 162 additions & 58 deletions
File tree
- docs/howto
- internal
- cmd
- codegen/golang
- templates/go-sql-driver-mysql
- compiler
- endtoend/testdata
- codegen_json/gen
- copyfrom/mysql
- go
- process_plugin_sqlc_gen_json/gen
- engine/dolphin
- plugin
- sql/ast
- protos/plugin
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
208 | 208 | | |
209 | 209 | | |
210 | 210 | | |
| 211 | + | |
| 212 | + | |
| 213 | + | |
| 214 | + | |
211 | 215 | | |
212 | 216 | | |
213 | 217 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
161 | 161 | | |
162 | 162 | | |
163 | 163 | | |
| 164 | + | |
164 | 165 | | |
165 | 166 | | |
166 | 167 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
279 | 279 | | |
280 | 280 | | |
281 | 281 | | |
| 282 | + | |
| 283 | + | |
282 | 284 | | |
283 | 285 | | |
284 | 286 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
218 | 218 | | |
219 | 219 | | |
220 | 220 | | |
221 | | - | |
222 | | - | |
223 | | - | |
224 | | - | |
225 | | - | |
226 | | - | |
227 | | - | |
228 | | - | |
| 221 | + | |
| 222 | + | |
| 223 | + | |
| 224 | + | |
| 225 | + | |
| 226 | + | |
| 227 | + | |
| 228 | + | |
| 229 | + | |
229 | 230 | | |
230 | 231 | | |
231 | 232 | | |
| |||
Lines changed: 8 additions & 1 deletion
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
25 | 25 | | |
26 | 26 | | |
27 | 27 | | |
| 28 | + | |
| 29 | + | |
| 30 | + | |
| 31 | + | |
| 32 | + | |
| 33 | + | |
28 | 34 | | |
29 | 35 | | |
30 | 36 | | |
| 37 | + | |
31 | 38 | | |
32 | 39 | | |
33 | 40 | | |
| |||
40 | 47 | | |
41 | 48 | | |
42 | 49 | | |
43 | | - | |
| 50 | + | |
44 | 51 | | |
45 | 52 | | |
46 | 53 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
55 | 55 | | |
56 | 56 | | |
57 | 57 | | |
| 58 | + | |
| 59 | + | |
| 60 | + | |
| 61 | + | |
| 62 | + | |
| 63 | + | |
| 64 | + | |
| 65 | + | |
| 66 | + | |
| 67 | + | |
| 68 | + | |
58 | 69 | | |
59 | 70 | | |
60 | 71 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
66389 | 66389 | | |
66390 | 66390 | | |
66391 | 66391 | | |
66392 | | - | |
| 66392 | + | |
| 66393 | + | |
66393 | 66394 | | |
66394 | 66395 | | |
66395 | 66396 | | |
| |||
66478 | 66479 | | |
66479 | 66480 | | |
66480 | 66481 | | |
66481 | | - | |
| 66482 | + | |
| 66483 | + | |
66482 | 66484 | | |
66483 | 66485 | | |
66484 | 66486 | | |
| |||
66630 | 66632 | | |
66631 | 66633 | | |
66632 | 66634 | | |
66633 | | - | |
| 66635 | + | |
| 66636 | + | |
66634 | 66637 | | |
66635 | 66638 | | |
66636 | 66639 | | |
| |||
66670 | 66673 | | |
66671 | 66674 | | |
66672 | 66675 | | |
66673 | | - | |
| 66676 | + | |
| 66677 | + | |
66674 | 66678 | | |
66675 | 66679 | | |
66676 | 66680 | | |
| |||
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.
Lines changed: 11 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
3 | 3 | | |
4 | 4 | | |
5 | 5 | | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
0 commit comments