forked frompostgres/postgres
- Notifications
You must be signed in to change notification settings - Fork6
Commite3161b2
committed
Add libpq support for recreating an error message with different verbosity.
Often, upon getting an unexpected error in psql, one's first wish is thatthe verbosity setting had been higher; for example, to be able to see theschema-name field or the server code location info. Up to now the only wayhas been to adjust the VERBOSITY variable and repeat the failing query.That's a pain, and it doesn't work if the error isn't reproducible.This commit adds support in libpq for regenerating the error message foran existing error PGresult at any desired verbosity level. This is almostjust a matter of refactoring the existing code into a subroutine, but thereis one bit of possibly-needed information that was not getting put intoPGresults: the text of the last query sent to the server. We must add thatstring to the contents of an error PGresult. But we only need to save itif it might be used, which with the existing error-formatting code onlyhappens if there is a PG_DIAG_STATEMENT_POSITION error field, which isprobably pretty rare for errors in production situations. So really theoverhead when the feature isn't used should be negligible.Alex Shulgin, reviewed by Daniel Vérité, some improvements by me1 parent5a5b917 commite3161b2
File tree
6 files changed
+217
-77
lines changed- doc/src/sgml
- src/interfaces/libpq
6 files changed
+217
-77
lines changedLines changed: 49 additions & 2 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
2691 | 2691 |
| |
2692 | 2692 |
| |
2693 | 2693 |
| |
| 2694 | + | |
| 2695 | + | |
| 2696 | + | |
| 2697 | + | |
| 2698 | + | |
| 2699 | + | |
| 2700 | + | |
| 2701 | + | |
| 2702 | + | |
| 2703 | + | |
| 2704 | + | |
| 2705 | + | |
| 2706 | + | |
| 2707 | + | |
| 2708 | + | |
| 2709 | + | |
| 2710 | + | |
| 2711 | + | |
| 2712 | + | |
| 2713 | + | |
| 2714 | + | |
| 2715 | + | |
| 2716 | + | |
| 2717 | + | |
| 2718 | + | |
| 2719 | + | |
| 2720 | + | |
| 2721 | + | |
| 2722 | + | |
| 2723 | + | |
| 2724 | + | |
| 2725 | + | |
| 2726 | + | |
| 2727 | + | |
| 2728 | + | |
| 2729 | + | |
| 2730 | + | |
| 2731 | + | |
| 2732 | + | |
| 2733 | + | |
| 2734 | + | |
| 2735 | + | |
2694 | 2736 |
| |
2695 | 2737 |
| |
2696 | 2738 |
| |
| |||
5582 | 5624 |
| |
5583 | 5625 |
| |
5584 | 5626 |
| |
| 5627 | + | |
| 5628 | + | |
5585 | 5629 |
| |
5586 | 5630 |
| |
5587 | 5631 |
| |
| |||
5622 | 5666 |
| |
5623 | 5667 |
| |
5624 | 5668 |
| |
| 5669 | + | |
| 5670 | + | |
5625 | 5671 |
| |
5626 | 5672 |
| |
5627 | 5673 |
| |
| |||
6089 | 6135 |
| |
6090 | 6136 |
| |
6091 | 6137 |
| |
6092 |
| - | |
6093 |
| - | |
| 6138 | + | |
| 6139 | + | |
| 6140 | + | |
6094 | 6141 |
| |
6095 | 6142 |
| |
6096 | 6143 |
| |
|
Lines changed: 1 addition & 0 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
170 | 170 |
| |
171 | 171 |
| |
172 | 172 |
| |
| 173 | + |
Lines changed: 39 additions & 0 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
159 | 159 |
| |
160 | 160 |
| |
161 | 161 |
| |
| 162 | + | |
162 | 163 |
| |
163 | 164 |
| |
164 | 165 |
| |
| |||
2598 | 2599 |
| |
2599 | 2600 |
| |
2600 | 2601 |
| |
| 2602 | + | |
| 2603 | + | |
| 2604 | + | |
| 2605 | + | |
| 2606 | + | |
| 2607 | + | |
| 2608 | + | |
| 2609 | + | |
| 2610 | + | |
| 2611 | + | |
| 2612 | + | |
| 2613 | + | |
| 2614 | + | |
| 2615 | + | |
| 2616 | + | |
| 2617 | + | |
| 2618 | + | |
| 2619 | + | |
| 2620 | + | |
| 2621 | + | |
| 2622 | + | |
| 2623 | + | |
| 2624 | + | |
| 2625 | + | |
| 2626 | + | |
| 2627 | + | |
| 2628 | + | |
| 2629 | + | |
| 2630 | + | |
| 2631 | + | |
| 2632 | + | |
| 2633 | + | |
| 2634 | + | |
| 2635 | + | |
| 2636 | + | |
| 2637 | + | |
| 2638 | + | |
| 2639 | + | |
2601 | 2640 |
| |
2602 | 2641 |
| |
2603 | 2642 |
| |
|
0 commit comments
Comments
(0)