postgresql/src/bin
Tom Lane 77cb4a1d67 Standardize describe.c's behavior for no-matching-objects a bit more.
Most functions in this file are content to print an empty table if there
are no matching objects.  In some, the behavior is to loop over all
matching objects and print a table for each one; therefore, without any
extra logic, nothing at all would be printed if no objects match.
We accept that outcome in QUIET mode, but in normal mode it seems better
to print a helpful message.  The new \dRp+ command had not gotten that
memo; fix it.

listDbRoleSettings() is out of step on this, but I think it's better for
it to print a custom message rather than an empty table, because of the
possibility that the user is confused about what the pattern arguments mean
or which is which.  The original message wording was entirely useless for
clarifying that, though, not to mention being unlike the wordings used
elsewhere.  Improve the text, and also print the messages with psql_error
as is the general custom here.

listTables() is also out in left field, but since it's such a heavily
used function, I'm hesitant to change its behavior so much as to print
an empty table rather than a custom message.  People are probably used
to getting a message.  But we can make the wording more standardized and
helpful, and print it with psql_error rather than printing to stdout.

In both listDbRoleSettings and listTables, we play dumb and emit an
empty table, not a custom message, in QUIET mode.  That was true before
and I see no need to change it.

Several of the places printing such messages risked dumping core if
no pattern string had been provided; make them more wary.  (This case
is presently unreachable in describeTableDetails; but it shouldn't be
assuming that command.c will never pass it a null.  The text search
functions would only reach the case if a database contained no text
search objects, which is also currently impossible since we pin the
built-in objects, but again it seems unwise to assume that here.)

Daniel Gustafsson, tweaked a bit by me

Discussion: https://postgr.es/m/3641F19B-336A-431A-86CE-A80562505C5E@yesql.se
2017-07-27 13:30:59 -04:00
..
initdb Fix broken link-command-line ordering for libpgfeutils. 2017-07-14 12:26:53 -04:00
pg_archivecleanup Translation updates 2017-07-10 11:53:55 -04:00
pg_basebackup Fix broken link-command-line ordering for libpgfeutils. 2017-07-14 12:26:53 -04:00
pg_config Translation updates 2017-07-10 11:53:55 -04:00
pg_controldata Translation updates 2017-07-10 11:53:55 -04:00
pg_ctl Work around Msys weakness in Testlib.pm's command_like() 2017-07-26 22:46:55 -04:00
pg_dump Fix pg_dump's handling of event triggers. 2017-07-22 20:20:09 -04:00
pg_resetwal Add static assertions about pg_control fitting into one disk sector. 2017-07-19 16:16:57 -04:00
pg_rewind pg_rewind: Fix some problems when copying files >2GB. 2017-07-21 14:25:36 -04:00
pg_test_fsync Translation updates 2017-07-10 11:53:55 -04:00
pg_test_timing Translation updates 2017-07-10 11:53:55 -04:00
pg_upgrade pg_upgrade i18n: Fix "%s server/cluster" wording 2017-07-14 19:21:34 -04:00
pg_waldump Translation updates 2017-07-10 11:53:55 -04:00
pgbench Fix broken link-command-line ordering for libpgfeutils. 2017-07-14 12:26:53 -04:00
pgevent Phase 3 of pgindent updates. 2017-06-21 15:35:54 -04:00
psql Standardize describe.c's behavior for no-matching-objects a bit more. 2017-07-27 13:30:59 -04:00
scripts Fix broken link-command-line ordering for libpgfeutils. 2017-07-14 12:26:53 -04:00
Makefile Rename user-facing tools with "xlog" in the name to say "wal". 2017-02-09 16:23:46 -05:00