- Notifications
You must be signed in to change notification settings - Fork4.9k
Commit18f8f78
committed
Handle empty or all-blank PAGER setting more sanely in psql.
If the PAGER environment variable is set but contains an empty string,psql would pass it to "sh" which would silently exit, causing whateverquery output we were printing to vanish entirely. This is quitemystifying; it took a long time for us to figure out that this was thecause of Joseph Brenner's trouble report. Rather than allowing thatto happen, we should treat this as another way to specify "no pager".(We could alternatively treat it as selecting the default pager, butit seems more likely that the former is what the user meant to achieveby setting PAGER this way.)Nonempty, but all-white-space, PAGER values have the same behavior, andit's pretty easy to test for that, so let's handle that case the same way.Most other cases of faulty PAGER values will result in the shell printingsome kind of complaint to stderr, which should be enough to diagnose theproblem, so we don't need to work harder than this. (Note that there'sbeen an intentional decision not to be very chatty about apparent failurereturns from the pager process, since that may happen if, eg, the userquits the pager with control-C or some such. I'd just as soon not startsplitting hairs about which exit codes might merit making our own report.)libpq's old PQprint() function was already on board with ignoring emptyPAGER values, but for consistency, make it ignore all-white-space valuesas well.It's been like this a long time, so back-patch to all supported branches.Discussion:https://postgr.es/m/CAFfgvXWLOE2novHzYjmQK8-J6TmHz42G8f3X0SORM44+stUGmw@mail.gmail.com1 parent81f2e51 commit18f8f78
File tree
3 files changed
+11
-3
lines changed- doc/src/sgml/ref
- src
- fe_utils
- interfaces/libpq
3 files changed
+11
-3
lines changedLines changed: 3 additions & 2 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
3801 | 3801 |
| |
3802 | 3802 |
| |
3803 | 3803 |
| |
3804 |
| - | |
3805 |
| - | |
| 3804 | + | |
| 3805 | + | |
| 3806 | + | |
3806 | 3807 |
| |
3807 | 3808 |
| |
3808 | 3809 |
| |
|
Lines changed: 6 additions & 0 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
2874 | 2874 |
| |
2875 | 2875 |
| |
2876 | 2876 |
| |
| 2877 | + | |
| 2878 | + | |
| 2879 | + | |
| 2880 | + | |
| 2881 | + | |
| 2882 | + | |
2877 | 2883 |
| |
2878 | 2884 |
| |
2879 | 2885 |
| |
|
Lines changed: 2 additions & 1 deletion
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
166 | 166 |
| |
167 | 167 |
| |
168 | 168 |
| |
| 169 | + | |
169 | 170 |
| |
170 |
| - | |
| 171 | + | |
171 | 172 |
| |
172 | 173 |
| |
173 | 174 |
| |
|
0 commit comments
Comments
(0)