- Notifications
You must be signed in to change notification settings - Fork5
Commitddc8893
committed
Fix miserable coding in pg_stat_get_activity().
Commitdd1a3bc replaced a test on whether a subroutine returned anull pointer with a test on whether &pointer->backendStatus was null.This accidentally failed to fail, at least on common compilers, becausebackendStatus is the first field in the struct; but it was surely troublewaiting to happen. Commitf91feba then messed things up further,changing the logic tolocal_beentry = pgstat_fetch_stat_local_beentry(curr_backend);if (!local_beentry)continue;beentry = &local_beentry->backendStatus;if (!beentry){where the second "if" is now dead code, so that the intended behavior ofprinting a row with "<backend information not available>" cannot occur.I suspect this is all moot because pgstat_fetch_stat_local_beentrywill never actually return null in this function's usage, but it's stillvery poor coding. Repair back to 9.4 where the original problem wasintroduced.1 parent24992c6 commitddc8893
1 file changed
+11
-15
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
688 | 688 | | |
689 | 689 | | |
690 | 690 | | |
691 | | - | |
692 | | - | |
693 | | - | |
694 | | - | |
695 | | - | |
696 | | - | |
697 | | - | |
698 | | - | |
699 | | - | |
700 | | - | |
701 | 691 | | |
702 | 692 | | |
703 | 693 | | |
704 | | - | |
705 | | - | |
706 | | - | |
707 | | - | |
708 | 694 | | |
709 | 695 | | |
710 | 696 | | |
711 | | - | |
| 697 | + | |
| 698 | + | |
| 699 | + | |
| 700 | + | |
| 701 | + | |
712 | 702 | | |
713 | 703 | | |
714 | 704 | | |
| |||
718 | 708 | | |
719 | 709 | | |
720 | 710 | | |
| 711 | + | |
| 712 | + | |
| 713 | + | |
| 714 | + | |
| 715 | + | |
| 716 | + | |
721 | 717 | | |
722 | 718 | | |
723 | 719 | | |
| |||
0 commit comments
Comments
(0)