1
0
mirror of https://github.com/postgres/postgres.git synced 2025-05-06 19:59:18 +03:00
Tom Lane bb39f58f76 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 whatever
query output we were printing to vanish entirely.  This is quite
mystifying; it took a long time for us to figure out that this was the
cause of Joseph Brenner's trouble report.  Rather than allowing that
to happen, we should treat this as another way to specify "no pager".
(We could alternatively treat it as selecting the default pager, but
it seems more likely that the former is what the user meant to achieve
by setting PAGER this way.)

Nonempty, but all-white-space, PAGER values have the same behavior, and
it'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 printing
some kind of complaint to stderr, which should be enough to diagnose the
problem, so we don't need to work harder than this.  (Note that there's
been an intentional decision not to be very chatty about apparent failure
returns from the pager process, since that may happen if, eg, the user
quits the pager with control-C or some such.  I'd just as soon not start
splitting hairs about which exit codes might merit making our own report.)

libpq's old PQprint() function was already on board with ignoring empty
PAGER values, but for consistency, make it ignore all-white-space values
as 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.com
2016-12-07 12:19:56 -05:00
..
2016-08-10 21:39:50 -04:00
2014-05-06 21:28:58 -04:00
2016-07-08 10:06:45 +03:00
2016-07-14 22:28:58 -04:00
2016-10-11 10:33:59 -04:00
2016-04-01 16:42:24 +03:00
2016-01-22 12:29:07 -05:00
2016-05-31 13:56:25 -04:00
2016-07-08 09:26:53 -04:00
2016-05-11 15:01:44 -04:00
2016-01-02 13:33:40 -05:00
2015-11-25 16:31:55 +03:00
2016-08-08 09:27:20 -04:00
2015-08-31 14:07:17 +02:00
2016-09-12 19:19:24 -04:00
2014-05-06 21:28:58 -04:00
2016-05-31 13:56:25 -04:00
2016-03-23 23:01:35 -03:00
2016-07-14 22:28:58 -04:00
2016-10-31 07:33:53 +09:00
2015-06-03 20:19:47 -04:00
2016-11-13 13:12:50 -05:00
2016-04-29 13:03:58 -04:00
2016-04-08 16:56:27 -04:00
2016-05-01 21:37:43 -04:00
2016-04-01 21:53:10 -04:00
2014-08-30 10:52:36 -05:00

<!-- doc/src/sgml/README.links -->

Linking within SGML documents can be confusing, so here is a summary:


Intra-document Linking
----------------------

<xref>
	use to get chapter/section number from the title of the target
	link, or xreflabel if defined at the target, or refentrytitle if target
        is a refentry;  has no close tag
	http://www.oasis-open.org/docbook/documentation/reference/html/xref.html

<link>
	use to supply text for the link, requires </link>
	http://www.oasis-open.org/docbook/documentation/reference/html/link.html

linkend=
	controls the target of the link/xref, required

endterm=
	for <xref>, allows the text of the link/xref to be taken from a
	different link target title


External Linking
----------------

<ulink>
	like <link>, but uses a URL (not a document target);  requires
	</ulink>; if no text is specified, the URL appears as the link
	text
	http://www.oasis-open.org/docbook/documentation/reference/html/ulink.html

url=
	used by <ulink> to specify the URL, required


Guidelines
----------

o  If you want to supply text, use <link>, else <xref>
o  Do not use text with <ulink> so the URL appears in printed output
o  Specific nouns like GUC variables, SQL commands, and contrib modules
   usually have xreflabels