postgresql/doc/src/sgml/ref
Tom Lane 18f8f784cb 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
..
abort.sgml doc: Improve DocBook XML validity 2014-02-23 21:31:08 -05:00
allfiles.sgml Support CREATE ACCESS METHOD 2016-03-23 23:01:35 -03:00
alter_aggregate.sgml Allow CURRENT/SESSION_USER to be used in certain commands 2015-03-09 15:41:54 -03:00
alter_collation.sgml Allow CURRENT/SESSION_USER to be used in certain commands 2015-03-09 15:41:54 -03:00
alter_conversion.sgml Allow CURRENT/SESSION_USER to be used in certain commands 2015-03-09 15:41:54 -03:00
alter_database.sgml Order some new options on man pages more sensibly, minor improvements 2015-09-17 20:57:47 -04:00
alter_default_privileges.sgml doc: Improve DocBook XML validity 2014-02-23 21:31:08 -05:00
alter_domain.sgml Doc: clarify that DROP ... CASCADE is recursive. 2016-08-12 18:45:18 -04:00
alter_event_trigger.sgml Allow CURRENT/SESSION_USER to be used in certain commands 2015-03-09 15:41:54 -03:00
alter_extension.sgml Add ALTER EXTENSION ADD/DROP ACCESS METHOD, and use it in pg_upgrade. 2016-10-02 14:31:28 -04:00
alter_foreign_data_wrapper.sgml Allow CURRENT/SESSION_USER to be used in certain commands 2015-03-09 15:41:54 -03:00
alter_foreign_table.sgml Doc: clarify that DROP ... CASCADE is recursive. 2016-08-12 18:45:18 -04:00
alter_function.sgml Doc: clarify description of CREATE/ALTER FUNCTION ... SET FROM CURRENT. 2016-08-09 13:39:24 -04:00
alter_group.sgml Allow CURRENT/SESSION_USER to be used in certain commands 2015-03-09 15:41:54 -03:00
alter_index.sgml Fix broken ALTER INDEX documentation 2016-04-05 19:03:42 -03:00
alter_language.sgml Allow CURRENT/SESSION_USER to be used in certain commands 2015-03-09 15:41:54 -03:00
alter_large_object.sgml Copy-edit the docs changes of OWNER TO CURRENT/SESSION_USER additions. 2015-07-10 14:39:29 +03:00
alter_materialized_view.sgml Fix duplication in ALTER MATERIALIZE VIEW synopsis 2016-11-14 11:14:34 -03:00
alter_opclass.sgml Copy-edit the docs changes of OWNER TO CURRENT/SESSION_USER additions. 2015-07-10 14:39:29 +03:00
alter_operator.sgml Add ALTER OPERATOR command, for changing selectivity estimator functions. 2015-07-14 18:17:55 +03:00
alter_opfamily.sgml Copy-edit the docs changes of OWNER TO CURRENT/SESSION_USER additions. 2015-07-10 14:39:29 +03:00
alter_policy.sgml Add support for restrictive RLS policies 2016-12-05 15:50:55 -05:00
alter_role.sgml Remove redundant CREATEUSER/NOCREATEUSER options in CREATE ROLE et al. 2015-10-22 09:34:03 -07:00
alter_rule.sgml doc: Improve DocBook XML validity 2014-02-23 21:31:08 -05:00
alter_schema.sgml Allow CURRENT/SESSION_USER to be used in certain commands 2015-03-09 15:41:54 -03:00
alter_sequence.sgml Allow CURRENT/SESSION_USER to be used in certain commands 2015-03-09 15:41:54 -03:00
alter_server.sgml Allow CURRENT/SESSION_USER to be used in certain commands 2015-03-09 15:41:54 -03:00
alter_system.sgml Docs: mention pg_reload_conf() in ALTER SYSTEM reference page. 2016-05-24 14:04:29 -04:00
alter_table.sgml Clarify policy on marking inherited constraints as valid. 2016-09-15 17:24:54 -04:00
alter_tablespace.sgml Allow CURRENT/SESSION_USER to be used in certain commands 2015-03-09 15:41:54 -03:00
alter_trigger.sgml Support ALTER THING .. DEPENDS ON EXTENSION 2016-04-05 18:38:54 -03:00
alter_tsconfig.sgml Allow CURRENT/SESSION_USER to be used in certain commands 2015-03-09 15:41:54 -03:00
alter_tsdictionary.sgml Allow CURRENT/SESSION_USER to be used in certain commands 2015-03-09 15:41:54 -03:00
alter_tsparser.sgml doc: Improve DocBook XML validity 2014-02-23 21:31:08 -05:00
alter_tstemplate.sgml doc: Improve DocBook XML validity 2014-02-23 21:31:08 -05:00
alter_type.sgml Support renaming an existing value of an enum type. 2016-09-07 16:11:56 -04:00
alter_user_mapping.sgml doc: Correct ALTER USER MAPPING example 2016-09-20 12:00:00 -04:00
alter_user.sgml Add [NO]BYPASSRLS options to CREATE USER and ALTER USER docs. 2016-01-28 09:33:09 -05:00
alter_view.sgml Allow CURRENT/SESSION_USER to be used in certain commands 2015-03-09 15:41:54 -03:00
analyze.sgml Allow foreign tables to participate in inheritance. 2015-03-22 13:53:21 -04:00
begin.sgml doc: Improve DocBook XML validity 2014-02-23 21:31:08 -05:00
checkpoint.sgml doc: Improve DocBook XML validity 2014-02-23 21:31:08 -05:00
close.sgml doc: Improve DocBook XML validity 2014-02-23 21:31:08 -05:00
cluster.sgml Add GUC and storage parameter to set the maximum size of GIN pending list. 2014-11-11 21:08:21 +09:00
clusterdb.sgml doc: Consistently use = sign in long options synopses 2016-10-19 08:48:48 -04:00
comment.sgml Fix thinko in description of table_name parameter 2016-06-07 18:18:26 -04:00
commit_prepared.sgml doc: Improve DocBook XML validity 2014-02-23 21:31:08 -05:00
commit.sgml doc: Improve DocBook XML validity 2014-02-23 21:31:08 -05:00
copy.sgml Support "COPY view FROM" for views with INSTEAD OF INSERT triggers. 2016-11-10 14:13:43 -05:00
create_access_method.sgml Doc: copy-editing in create_access_method.sgml. 2016-08-16 11:35:36 -04:00
create_aggregate.sgml Improve user-facing documentation for partial/parallel aggregation. 2016-06-22 19:14:16 -04:00
create_cast.sgml docs: remove unnecessary references to old PG versions 2014-02-24 12:56:37 -05:00
create_collation.sgml doc: Improve DocBook XML validity 2014-02-23 21:31:08 -05:00
create_conversion.sgml doc: Improve DocBook XML validity 2014-02-23 21:31:08 -05:00
create_database.sgml Fix typo in CREATE DATABASE syntax synopsis. 2016-05-31 12:05:22 -04:00
create_domain.sgml doc: Spell checking 2015-09-10 21:35:06 -04:00
create_event_trigger.sgml doc: Tweak synopsis indentation for consistency 2015-09-21 23:31:43 -04:00
create_extension.sgml Doc: minor documentation improvements about extensions. 2016-09-07 13:36:08 -04:00
create_foreign_data_wrapper.sgml doc: Improve DocBook XML validity 2014-02-23 21:31:08 -05:00
create_foreign_table.sgml doc: CREATE FOREIGN TABLE now allows CHECK ( ... ) NO INHERIT 2015-05-15 14:42:15 -04:00
create_function.sgml Doc: clarify description of CREATE/ALTER FUNCTION ... SET FROM CURRENT. 2016-08-09 13:39:24 -04:00
create_group.sgml Remove redundant CREATEUSER/NOCREATEUSER options in CREATE ROLE et al. 2015-10-22 09:34:03 -07:00
create_index.sgml psql: Split up "Modifiers" column in \d and \dD 2016-11-03 14:02:46 -04:00
create_language.sgml doc: Improve DocBook XML validity 2014-02-23 21:31:08 -05:00
create_materialized_view.sgml doc: Fix markup 2014-12-13 14:16:16 -05:00
create_opclass.sgml Replace the built-in GIN array opclasses with a single polymorphic opclass. 2016-09-26 14:52:44 -04:00
create_operator.sgml doc: Improve DocBook XML validity 2014-02-23 21:31:08 -05:00
create_opfamily.sgml doc: Improve DocBook XML validity 2014-02-23 21:31:08 -05:00
create_policy.sgml Add support for restrictive RLS policies 2016-12-05 15:50:55 -05:00
create_role.sgml Remove redundant CREATEUSER/NOCREATEUSER options in CREATE ROLE et al. 2015-10-22 09:34:03 -07:00
create_rule.sgml Add support for INSERT ... ON CONFLICT DO NOTHING/UPDATE. 2015-05-08 05:43:10 +02:00
create_schema.sgml Use gender-neutral language in documentation 2015-09-21 22:57:29 -04:00
create_sequence.sgml doc: more replacement of <literal> with something better 2016-08-24 21:11:44 -04:00
create_server.sgml doc: Improve DocBook XML validity 2014-02-23 21:31:08 -05:00
create_table_as.sgml Add CINE option for CREATE TABLE AS and CREATE MATERIALIZED VIEW 2014-12-13 13:56:09 -05:00
create_table.sgml Improve documentation about CREATE TABLE ... LIKE. 2016-07-28 13:26:58 -04:00
create_tablespace.sgml Allow per-tablespace effective_io_concurrency 2015-09-08 12:51:42 -03:00
create_transform.sgml Fix typo in create_transform.sgml. 2016-01-06 08:03:50 +09:00
create_trigger.sgml Implement syntax for transition tables in AFTER triggers. 2016-11-04 10:49:50 -05:00
create_tsconfig.sgml doc: Improve DocBook XML validity 2014-02-23 21:31:08 -05:00
create_tsdictionary.sgml doc: Improve DocBook XML validity 2014-02-23 21:31:08 -05:00
create_tsparser.sgml doc: Improve DocBook XML validity 2014-02-23 21:31:08 -05:00
create_tstemplate.sgml doc: Improve DocBook XML validity 2014-02-23 21:31:08 -05:00
create_type.sgml Hyphenate variable-length for consistency. 2015-10-08 12:29:25 -04:00
create_user_mapping.sgml Use gender-neutral language in documentation 2015-09-21 22:57:29 -04:00
create_user.sgml Add [NO]BYPASSRLS options to CREATE USER and ALTER USER docs. 2016-01-28 09:33:09 -05:00
create_view.sgml Improve documentation for CREATE RECURSIVE VIEW. 2016-10-11 10:08:45 -04:00
createdb.sgml doc: Improve DocBook XML validity 2014-02-23 21:31:08 -05:00
createlang.sgml doc: Improve DocBook XML validity 2014-02-23 21:31:08 -05:00
createuser.sgml doc: Improve DocBook XML validity 2014-02-23 21:31:08 -05:00
deallocate.sgml doc: Improve DocBook XML validity 2014-02-23 21:31:08 -05:00
declare.sgml doc: Improve DocBook XML validity 2014-02-23 21:31:08 -05:00
delete.sgml doc: Improve DocBook XML validity 2014-02-23 21:31:08 -05:00
discard.sgml Improve DISCARD documentation. 2014-08-17 15:59:03 -04:00
do.sgml doc: Improve DocBook XML validity 2014-02-23 21:31:08 -05:00
drop_access_method.sgml Doc: clarify that DROP ... CASCADE is recursive. 2016-08-12 18:45:18 -04:00
drop_aggregate.sgml Doc: clarify that DROP ... CASCADE is recursive. 2016-08-12 18:45:18 -04:00
drop_cast.sgml doc: Improve DocBook XML validity 2014-02-23 21:31:08 -05:00
drop_collation.sgml Doc: clarify that DROP ... CASCADE is recursive. 2016-08-12 18:45:18 -04:00
drop_conversion.sgml doc: Improve DocBook XML validity 2014-02-23 21:31:08 -05:00
drop_database.sgml doc: Improve DocBook XML validity 2014-02-23 21:31:08 -05:00
drop_domain.sgml Doc: clarify that DROP ... CASCADE is recursive. 2016-08-12 18:45:18 -04:00
drop_event_trigger.sgml Doc: clarify that DROP ... CASCADE is recursive. 2016-08-12 18:45:18 -04:00
drop_extension.sgml Doc: clarify that DROP ... CASCADE is recursive. 2016-08-12 18:45:18 -04:00
drop_foreign_data_wrapper.sgml Doc: clarify that DROP ... CASCADE is recursive. 2016-08-12 18:45:18 -04:00
drop_foreign_table.sgml Doc: clarify that DROP ... CASCADE is recursive. 2016-08-12 18:45:18 -04:00
drop_function.sgml Doc: clarify that DROP ... CASCADE is recursive. 2016-08-12 18:45:18 -04:00
drop_group.sgml doc: Improve DocBook XML validity 2014-02-23 21:31:08 -05:00
drop_index.sgml Doc: clarify that DROP ... CASCADE is recursive. 2016-08-12 18:45:18 -04:00
drop_language.sgml Doc: clarify that DROP ... CASCADE is recursive. 2016-08-12 18:45:18 -04:00
drop_materialized_view.sgml Doc: clarify that DROP ... CASCADE is recursive. 2016-08-12 18:45:18 -04:00
drop_opclass.sgml Doc: clarify that DROP ... CASCADE is recursive. 2016-08-12 18:45:18 -04:00
drop_operator.sgml Doc: clarify that DROP ... CASCADE is recursive. 2016-08-12 18:45:18 -04:00
drop_opfamily.sgml Doc: clarify that DROP ... CASCADE is recursive. 2016-08-12 18:45:18 -04:00
drop_owned.sgml Doc: clarify that DROP ... CASCADE is recursive. 2016-08-12 18:45:18 -04:00
drop_policy.sgml Doc: clarify that DROP ... CASCADE is recursive. 2016-08-12 18:45:18 -04:00
drop_role.sgml Improve documentation of the role-dropping process. 2015-10-07 16:12:05 -04:00
drop_rule.sgml Doc: clarify that DROP ... CASCADE is recursive. 2016-08-12 18:45:18 -04:00
drop_schema.sgml Doc: clarify that DROP ... CASCADE is recursive. 2016-08-12 18:45:18 -04:00
drop_sequence.sgml Doc: clarify that DROP ... CASCADE is recursive. 2016-08-12 18:45:18 -04:00
drop_server.sgml Doc: clarify that DROP ... CASCADE is recursive. 2016-08-12 18:45:18 -04:00
drop_table.sgml Doc: clarify that DROP ... CASCADE is recursive. 2016-08-12 18:45:18 -04:00
drop_tablespace.sgml doc: Improve DocBook XML validity 2014-02-23 21:31:08 -05:00
drop_transform.sgml Doc: clarify that DROP ... CASCADE is recursive. 2016-08-12 18:45:18 -04:00
drop_trigger.sgml Doc: clarify that DROP ... CASCADE is recursive. 2016-08-12 18:45:18 -04:00
drop_tsconfig.sgml Doc: clarify that DROP ... CASCADE is recursive. 2016-08-12 18:45:18 -04:00
drop_tsdictionary.sgml Doc: clarify that DROP ... CASCADE is recursive. 2016-08-12 18:45:18 -04:00
drop_tsparser.sgml Doc: clarify that DROP ... CASCADE is recursive. 2016-08-12 18:45:18 -04:00
drop_tstemplate.sgml Doc: clarify that DROP ... CASCADE is recursive. 2016-08-12 18:45:18 -04:00
drop_type.sgml Doc: clarify that DROP ... CASCADE is recursive. 2016-08-12 18:45:18 -04:00
drop_user_mapping.sgml Use gender-neutral language in documentation 2015-09-21 22:57:29 -04:00
drop_user.sgml Improve documentation of the role-dropping process. 2015-10-07 16:12:05 -04:00
drop_view.sgml Doc: clarify that DROP ... CASCADE is recursive. 2016-08-12 18:45:18 -04:00
dropdb.sgml doc: Improve DocBook XML validity 2014-02-23 21:31:08 -05:00
droplang.sgml doc: Improve DocBook XML validity 2014-02-23 21:31:08 -05:00
dropuser.sgml doc: Improve DocBook XML validity 2014-02-23 21:31:08 -05:00
ecpg-ref.sgml doc: Improve DocBook XML validity 2014-02-23 21:31:08 -05:00
end.sgml doc: Improve DocBook XML validity 2014-02-23 21:31:08 -05:00
execute.sgml doc: Improve DocBook XML validity 2014-02-23 21:31:08 -05:00
explain.sgml Print planning time only in EXPLAIN ANALYZE, not plain EXPLAIN. 2014-10-15 18:50:13 -04:00
fetch.sgml doc: Improve DocBook XML validity 2014-02-23 21:31:08 -05:00
grant.sgml Use gender-neutral language in documentation 2015-09-21 22:57:29 -04:00
import_foreign_schema.sgml doc: Tweak synopsis indentation for consistency 2015-09-21 23:31:43 -04:00
initdb.sgml initdb pg_basebackup: Rename --noxxx options to --no-xxx 2016-10-19 08:48:48 -04:00
insert.sgml doc: Whitespace fixes in man pages 2016-08-02 12:35:35 -04:00
listen.sgml doc: Improve DocBook XML validity 2014-02-23 21:31:08 -05:00
load.sgml doc: Improve DocBook XML validity 2014-02-23 21:31:08 -05:00
lock.sgml Allow LOCK TABLE .. ROW EXCLUSIVE MODE with INSERT 2015-05-11 15:44:12 -04:00
move.sgml doc: Improve DocBook XML validity 2014-02-23 21:31:08 -05:00
notify.sgml doc: Change recommendation to put NOTIFY into a rule 2016-08-03 12:29:15 -04:00
pg_basebackup.sgml Fix typo 2016-11-08 18:37:40 +01:00
pg_config-ref.sgml docs: remove unnecessary references to old PG versions 2014-02-24 12:56:37 -05:00
pg_controldata.sgml Add -D option to specify data directory to pg_controldata and pg_resetxlog. 2014-09-25 13:37:19 +03:00
pg_ctl-ref.sgml pg_ctl: Add long option for -o 2016-10-19 08:48:48 -04:00
pg_dump.sgml Add --no-blobs option to pg_dump 2016-11-29 11:09:35 -05:00
pg_dumpall.sgml Improve documentation about pg_dump's --quote-all-identifiers switch. 2016-05-20 14:59:47 -04:00
pg_isready.sgml docs: Improve pg_isready details about username/dbname 2014-09-06 12:43:11 -04:00
pg_receivexlog.sgml Fix typos 2016-07-20 10:39:18 +02:00
pg_recvlogical.sgml Fix typos 2016-07-20 10:39:18 +02:00
pg_resetxlog.sgml Rename "pg_xlog" directory to "pg_wal". 2016-10-20 11:32:18 -04:00
pg_restore.sgml pg_restore: Add -N option to exclude schemas 2016-09-20 12:00:00 -04:00
pg_rewind.sgml Rename "pg_xlog" directory to "pg_wal". 2016-10-20 11:32:18 -04:00
pg_xlogdump.sgml Rename "pg_xlog" directory to "pg_wal". 2016-10-20 11:32:18 -04:00
pgarchivecleanup.sgml doc: Remove some confusion from pg_archivecleanup doc 2016-08-16 15:33:52 -04:00
pgbench.sgml pgbench: Allow the transaction log file prefix to be changed. 2016-11-09 16:28:43 -05:00
pgtestfsync.sgml Rename "pg_xlog" directory to "pg_wal". 2016-10-20 11:32:18 -04:00
pgtesttiming.sgml pg_test_timing: Add NLS 2016-11-04 10:40:05 -04:00
pgupgrade.sgml Rename "pg_xlog" directory to "pg_wal". 2016-10-20 11:32:18 -04:00
postgres-ref.sgml Remove TZ environment-variable entry from postgres reference page. 2016-03-29 21:38:41 -04:00
postmaster.sgml doc: Improve DocBook XML validity 2014-02-23 21:31:08 -05:00
prepare_transaction.sgml doc: Improve DocBook XML validity 2014-02-23 21:31:08 -05:00
prepare.sgml document when PREPARE uses generic plans 2016-06-14 16:11:48 -04:00
psql-ref.sgml Handle empty or all-blank PAGER setting more sanely in psql. 2016-12-07 12:19:56 -05:00
reassign_owned.sgml Improve documentation of the role-dropping process. 2015-10-07 16:12:05 -04:00
refresh_materialized_view.sgml doc: Improve DocBook XML validity 2014-02-23 21:31:08 -05:00
reindex.sgml Simplify syntax diagram for REINDEX. 2016-02-04 13:58:40 -05:00
reindexdb.sgml doc: Consistently use = sign in long options synopses 2016-10-19 08:48:48 -04:00
release_savepoint.sgml doc: Improve DocBook XML validity 2014-02-23 21:31:08 -05:00
reset.sgml doc: Improve DocBook XML validity 2014-02-23 21:31:08 -05:00
revoke.sgml Use gender-neutral language in documentation 2015-09-21 22:57:29 -04:00
rollback_prepared.sgml doc: Improve DocBook XML validity 2014-02-23 21:31:08 -05:00
rollback_to.sgml doc: Improve DocBook XML validity 2014-02-23 21:31:08 -05:00
rollback.sgml doc: Improve DocBook XML validity 2014-02-23 21:31:08 -05:00
savepoint.sgml doc: Improve DocBook XML validity 2014-02-23 21:31:08 -05:00
security_label.sgml Move test modules from contrib to src/test/modules 2014-11-29 23:55:00 -03:00
select_into.sgml docs: remove unnecessary references to old PG versions 2014-02-24 12:56:37 -05:00
select.sgml Correct TABLESAMPLE docs 2016-09-09 11:19:21 +01:00
set_constraints.sgml doc: Improve DocBook XML validity 2014-02-23 21:31:08 -05:00
set_role.sgml doc: more replacement of <literal> with something better 2016-08-24 21:11:44 -04:00
set_session_auth.sgml doc: more replacement of <literal> with something better 2016-08-24 21:11:44 -04:00
set_transaction.sgml doc: Improve DocBook XML validity 2014-02-23 21:31:08 -05:00
set.sgml doc: Improve DocBook XML validity 2014-02-23 21:31:08 -05:00
show.sgml doc: Improve DocBook XML validity 2014-02-23 21:31:08 -05:00
start_transaction.sgml doc: Improve DocBook XML validity 2014-02-23 21:31:08 -05:00
truncate.sgml Improve documentation about MVCC-unsafe utility commands. 2015-08-15 13:30:16 -04:00
unlisten.sgml doc: Improve DocBook XML validity 2014-02-23 21:31:08 -05:00
update.sgml Improve handling of "UPDATE ... SET (column_list) = row_constructor". 2016-11-22 15:20:10 -05:00
vacuum.sgml Make getrusage() output a little more readable 2016-10-19 09:53:16 -04:00
vacuumdb.sgml doc: Consistently use = sign in long options synopses 2016-10-19 08:48:48 -04:00
values.sgml doc: add link for list-of-scalars mention 2016-06-28 16:16:06 -04:00