Commit f64f4c3
committed
Fix tracking of psql script line numbers during \copy from another place.
Commit 0814677 changed do_copy() to
temporarily scribble on pset.cur_cmd_source. That was a mighty ugly bit of
code in any case, but in particular it broke handleCopyIn's ability to tell
whether it was reading from the current script source file (in which case
pset.lineno should be incremented for each line of COPY data), or from
someplace else (in which case it shouldn't). The former case still worked,
the latter not so much. The visible effect was that line numbers reported
for errors in a script file would be wrong if there were an earlier \copy
that was reading anything other than inline-in-the-script-file data.
To fix, introduce another pset field that holds the file do_copy wants the
COPY code to use. This is a little bit ugly, but less so than passing the
file down explicitly through several layers that aren't COPY-specific.
Extracted from a larger patch by Kumar Rajeev Rastogi; that patch also
changes printing of COPY command tags, which is not a bug fix and shouldn't
get back-patched. This particular idea was from a suggestion by Amit
Khandekar, if I'm reading the thread correctly.
Back-patch to 9.2 where the faulty code was introduced.1 parent 73f0483 commit f64f4c3
4 files changed
+26
-14
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
630 | 630 | | |
631 | 631 | | |
632 | 632 | | |
633 | | - | |
| 633 | + | |
634 | 634 | | |
635 | 635 | | |
636 | 636 | | |
| |||
690 | 690 | | |
691 | 691 | | |
692 | 692 | | |
| 693 | + | |
| 694 | + | |
| 695 | + | |
693 | 696 | | |
| 697 | + | |
| 698 | + | |
694 | 699 | | |
695 | 700 | | |
696 | | - | |
| 701 | + | |
| 702 | + | |
| 703 | + | |
| 704 | + | |
| 705 | + | |
| 706 | + | |
697 | 707 | | |
698 | | - | |
| 708 | + | |
| 709 | + | |
| 710 | + | |
| 711 | + | |
| 712 | + | |
699 | 713 | | |
| 714 | + | |
700 | 715 | | |
701 | 716 | | |
702 | 717 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
271 | 271 | | |
272 | 272 | | |
273 | 273 | | |
274 | | - | |
275 | | - | |
276 | 274 | | |
277 | 275 | | |
278 | | - | |
279 | 276 | | |
280 | 277 | | |
281 | 278 | | |
| |||
289 | 286 | | |
290 | 287 | | |
291 | 288 | | |
292 | | - | |
293 | | - | |
294 | 289 | | |
295 | 290 | | |
296 | 291 | | |
| |||
310 | 305 | | |
311 | 306 | | |
312 | 307 | | |
313 | | - | |
314 | | - | |
315 | 308 | | |
316 | 309 | | |
317 | 310 | | |
| |||
347 | 340 | | |
348 | 341 | | |
349 | 342 | | |
| 343 | + | |
| 344 | + | |
350 | 345 | | |
351 | 346 | | |
352 | 347 | | |
| |||
370 | 365 | | |
371 | 366 | | |
372 | 367 | | |
373 | | - | |
374 | | - | |
375 | | - | |
| 368 | + | |
| 369 | + | |
376 | 370 | | |
377 | | - | |
| 371 | + | |
378 | 372 | | |
379 | 373 | | |
380 | 374 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
70 | 70 | | |
71 | 71 | | |
72 | 72 | | |
| 73 | + | |
| 74 | + | |
73 | 75 | | |
74 | 76 | | |
75 | 77 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
120 | 120 | | |
121 | 121 | | |
122 | 122 | | |
| 123 | + | |
123 | 124 | | |
124 | 125 | | |
125 | 126 | | |
| |||
0 commit comments