forked frompostgres/postgres
- Notifications
You must be signed in to change notification settings - Fork6
Commitf3316a0
committed
Fix pg_restore's direct-to-database mode for INSERT-style table data.
In commit6545a90, I removed the mini SQLlexer that was in pg_backup_db.c, thinking that it had no real purposebeyond separating COPY data from SQL commands, which purpose had beenobsoleted by long-ago fixes in pg_dump's archive file format.Unfortunately this was in error: that code was also used to identifycommand boundaries in INSERT-style table data, which is run together as asingle string in the archive file for better compressibility. As a result,direct-to-database restores from archive files made with --inserts or--column-inserts fail in our latest releases, as reported by Dick Visser.To fix, restore the mini SQL lexer, but simplify it by adjusting thecalling logic so that it's only required to cope with INSERT-style tabledata, not arbitrary SQL commands. This allows us to not have to deal withSQL comments, E'' strings, or dollar-quoted strings, none of which haveever been emitted by dumpTableData_insert.Also, fix the lexer to cope with standard-conforming strings, which was theactual bug that the previous patch was meant to solve.Back-patch to all supported branches. The previous patch went back to 8.2,which unfortunately means that the EOL release of 8.2 contains this bug,but I don't think we're doing another 8.2 release just because of that.1 parent7e4911b commitf3316a0
File tree
4 files changed
+135
-11
lines changed- src/bin/pg_dump
4 files changed
+135
-11
lines changedLines changed: 14 additions & 9 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
620 | 620 |
| |
621 | 621 |
| |
622 | 622 |
| |
623 |
| - | |
| 623 | + | |
624 | 624 |
| |
| 625 | + | |
| 626 | + | |
625 | 627 |
| |
626 | 628 |
| |
627 | 629 |
| |
628 | 630 |
| |
629 | 631 |
| |
630 | 632 |
| |
631 |
| - | |
632 |
| - | |
633 |
| - | |
634 |
| - | |
635 |
| - | |
636 |
| - | |
| 633 | + | |
| 634 | + | |
| 635 | + | |
| 636 | + | |
637 | 637 |
| |
638 | 638 |
| |
639 | 639 |
| |
| |||
1975 | 1975 |
| |
1976 | 1976 |
| |
1977 | 1977 |
| |
| 1978 | + | |
| 1979 | + | |
1978 | 1980 |
| |
1979 | 1981 |
| |
1980 | 1982 |
| |
| |||
4194 | 4196 |
| |
4195 | 4197 |
| |
4196 | 4198 |
| |
4197 |
| - | |
| 4199 | + | |
| 4200 | + | |
4198 | 4201 |
| |
4199 | 4202 |
| |
4200 | 4203 |
| |
| |||
4227 | 4230 |
| |
4228 | 4231 |
| |
4229 | 4232 |
| |
4230 |
| - | |
| 4233 | + | |
| 4234 | + | |
| 4235 | + | |
4231 | 4236 |
| |
4232 | 4237 |
| |
4233 | 4238 |
| |
|
Lines changed: 24 additions & 1 deletion
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
132 | 132 |
| |
133 | 133 |
| |
134 | 134 |
| |
| 135 | + | |
| 136 | + | |
| 137 | + | |
| 138 | + | |
| 139 | + | |
| 140 | + | |
| 141 | + | |
| 142 | + | |
| 143 | + | |
| 144 | + | |
| 145 | + | |
| 146 | + | |
| 147 | + | |
| 148 | + | |
135 | 149 |
| |
136 | 150 |
| |
137 | 151 |
| |
| |||
140 | 154 |
| |
141 | 155 |
| |
142 | 156 |
| |
| 157 | + | |
| 158 | + | |
| 159 | + | |
| 160 | + | |
| 161 | + | |
| 162 | + | |
| 163 | + | |
143 | 164 |
| |
144 | 165 |
| |
145 | 166 |
| |
| |||
167 | 188 |
| |
168 | 189 |
| |
169 | 190 |
| |
| 191 | + | |
| 192 | + | |
170 | 193 |
| |
171 | 194 |
| |
172 | 195 |
| |
| |||
217 | 240 |
| |
218 | 241 |
| |
219 | 242 |
| |
220 |
| - | |
| 243 | + | |
221 | 244 |
| |
222 | 245 |
| |
223 | 246 |
| |
|
Lines changed: 89 additions & 1 deletion
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
364 | 364 |
| |
365 | 365 |
| |
366 | 366 |
| |
| 367 | + | |
| 368 | + | |
| 369 | + | |
| 370 | + | |
| 371 | + | |
| 372 | + | |
| 373 | + | |
| 374 | + | |
| 375 | + | |
| 376 | + | |
| 377 | + | |
| 378 | + | |
| 379 | + | |
| 380 | + | |
| 381 | + | |
| 382 | + | |
| 383 | + | |
| 384 | + | |
| 385 | + | |
| 386 | + | |
| 387 | + | |
| 388 | + | |
| 389 | + | |
| 390 | + | |
| 391 | + | |
| 392 | + | |
| 393 | + | |
| 394 | + | |
| 395 | + | |
| 396 | + | |
| 397 | + | |
| 398 | + | |
| 399 | + | |
| 400 | + | |
| 401 | + | |
| 402 | + | |
| 403 | + | |
| 404 | + | |
| 405 | + | |
| 406 | + | |
| 407 | + | |
| 408 | + | |
| 409 | + | |
| 410 | + | |
| 411 | + | |
| 412 | + | |
| 413 | + | |
| 414 | + | |
| 415 | + | |
| 416 | + | |
| 417 | + | |
| 418 | + | |
| 419 | + | |
| 420 | + | |
| 421 | + | |
| 422 | + | |
| 423 | + | |
| 424 | + | |
| 425 | + | |
| 426 | + | |
| 427 | + | |
| 428 | + | |
| 429 | + | |
| 430 | + | |
| 431 | + | |
| 432 | + | |
| 433 | + | |
| 434 | + | |
| 435 | + | |
| 436 | + | |
| 437 | + | |
| 438 | + | |
| 439 | + | |
| 440 | + | |
| 441 | + | |
| 442 | + | |
367 | 443 |
| |
368 | 444 |
| |
369 | 445 |
| |
370 | 446 |
| |
371 | 447 |
| |
372 | 448 |
| |
373 |
| - | |
| 449 | + | |
374 | 450 |
| |
375 | 451 |
| |
| 452 | + | |
| 453 | + | |
376 | 454 |
| |
377 | 455 |
| |
378 | 456 |
| |
| |||
382 | 460 |
| |
383 | 461 |
| |
384 | 462 |
| |
| 463 | + | |
| 464 | + | |
| 465 | + | |
| 466 | + | |
| 467 | + | |
| 468 | + | |
| 469 | + | |
385 | 470 |
| |
386 | 471 |
| |
387 | 472 |
| |
| 473 | + | |
| 474 | + | |
| 475 | + | |
388 | 476 |
| |
389 | 477 |
| |
390 | 478 |
| |
|
Lines changed: 8 additions & 0 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
1399 | 1399 |
| |
1400 | 1400 |
| |
1401 | 1401 |
| |
| 1402 | + | |
| 1403 | + | |
| 1404 | + | |
| 1405 | + | |
| 1406 | + | |
| 1407 | + | |
| 1408 | + | |
| 1409 | + | |
1402 | 1410 |
| |
1403 | 1411 |
| |
1404 | 1412 |
| |
|
0 commit comments
Comments
(0)