pg.ddx.io  pgsql-bugs@postgresql.org mailing list archive  
help / color / mirror / Atom feed
BUG #17148: About --no-strict-names option and --quiet option of pg_amcheck command
16+ messages / 7 participants
[nested] [flat]

* BUG #17148: About --no-strict-names option and --quiet option of pg_amcheck command
@ 2021-08-17 04:34  PG Bug reporting form <noreply@postgresql.org>
  0 siblings, 1 reply; 16+ messages in thread

From: PG Bug reporting form @ 2021-08-17 04:34 UTC (permalink / raw)
  To: pgsql-bugs@lists.postgresql.org; +Cc: chenjq.jy@fujitsu.com

The following bug has been logged on the website:

Bug reference:      17148
Logged by:          Chen Jiaoqian
Email address:      chenjq.jy@fujitsu.com
PostgreSQL version: 14beta3
Operating system:   Red Hat Enterprise Linux Server release 7.8
Description:        

Hi, Author

    In PG14 beta3, when I use pg_amcheck command, both --no-strict-names
option and --quiet option are specified, the warning message of --database
option is not suppressed.
    The official website is described as follows:
    > --no-strict-names
    >    By default, if an argument to --database, --table, --index, or
--relation matches no objects, it is a fatal error. 
    >    This option downgrades that error to a warning. If this option is
used with --quiet, the warning will be suppressed as well.
    
    When I specify a non-existent database name for the --database option,
and specify the --no-strict-names option and the --quiet option, 
    pg_amcheck command should not return any message, but it still returns
the warning message.
    
    My steps are as follows:
        1)Install the amcheck plguin in the PG source package
../contrib/amcheck directory;
        2)In the postgres database, execute SQL "create extension
amcheck;"
        3)On the OS command line, execute pg_amcheck command, specify
--no-strict-names option and --quiet option, and specify a non-existent
database name for the --database option

    The result are as follows:
        [postgres14@localhost ~]$ pg_amcheck -p 51403 -d postgres -d db01
--no-strict-names --quiet
        pg_amcheck: warning: no connectable databases to check matching
"db01"
        [postgres14@localhost ~]$

Regards.



^ permalink  raw  reply  [nested|flat] 16+ messages in thread

* Re: BUG #17148: About --no-strict-names option and --quiet option of pg_amcheck command
@ 2021-08-17 08:14  Daniel Gustafsson <daniel@yesql.se>
  parent: PG Bug reporting form <noreply@postgresql.org>
  0 siblings, 1 reply; 16+ messages in thread

From: Daniel Gustafsson @ 2021-08-17 08:14 UTC (permalink / raw)
  To: chenjq.jy@fujitsu.com; pgsql-bugs@lists.postgresql.org

> On 17 Aug 2021, at 06:34, PG Bug reporting form <noreply@postgresql.org> wrote:

>    In PG14 beta3, when I use pg_amcheck command, both --no-strict-names
> option and --quiet option are specified, the warning message of --database
> option is not suppressed.
>    The official website is described as follows:
>> --no-strict-names
>>   By default, if an argument to --database, --table, --index, or
> --relation matches no objects, it is a fatal error. 
>>   This option downgrades that error to a warning. If this option is
> used with --quiet, the warning will be suppressed as well.
> 
>    When I specify a non-existent database name for the --database option,
> and specify the --no-strict-names option and the --quiet option, 
>    pg_amcheck command should not return any message, but it still returns
> the warning message.

Agreed, in order to match the documentation the attached is required, which
also matches other invocations of log_no_match().  This should be applied
backpatched to 14 unless there are objections.

--
Daniel Gustafsson		https://vmware.com/

Attachments:

pg_amcheck_strict_names.diff (application/octet-stream, 602B) download diff --git a/src/bin/pg_amcheck/pg_amcheck.c b/src/bin/pg_amcheck/pg_amcheck.c index bcb02db495..a092e7d8a9 100644 --- a/src/bin/pg_amcheck/pg_amcheck.c +++ b/src/bin/pg_amcheck/pg_amcheck.c @@ -1672,8 +1672,9 @@ compile_database_list(PGconn *conn, SimplePtrList *databases, pattern_id); exit(1); } - log_no_match("no connectable databases to check matching \"%s\"", - opts.include.data[pattern_id].pattern); + if (!opts.quiet || fatal) + log_no_match("no connectable databases to check matching \"%s\"", + opts.include.data[pattern_id].pattern); } else {
^ permalink raw reply [nested|flat] 16+ messages in thread

* Re: BUG #17148: About --no-strict-names option and --quiet option of pg_amcheck command
@ 2021-08-17 11:06  Daniel Gustafsson <daniel@yesql.se>
  parent: Daniel Gustafsson <daniel@yesql.se>
  0 siblings, 1 reply; 16+ messages in thread

From: Daniel Gustafsson @ 2021-08-17 11:06 UTC (permalink / raw)
  To: chenjq.jy@fujitsu.com; pgsql-bugs@lists.postgresql.org; +Cc: Julien Rouhaud <rjuju123@gmail.com>

Julien Rouhaud also pointed out off-list that the help output and documentation
aren't in agreement about how --quiet works. In the documentation we say:

	"Print fewer messages, and less detail regarding any server errors."

But the help output takes a stronger position on this:

	$ ./bin/pg_amcheck --help |grep quiet
	  -q, --quiet                     don't write any messages

The latter isn't entirely true IMO, so I think we should reconcile them with
something like this while in here and fixing things anyways:

-       printf(_("  -q, --quiet                     don't write any messages\n"));
+       printf(_("  -q, --quiet                     print fewer and less detailed messages\n"));

Thoughts?

--
Daniel Gustafsson		https://vmware.com/






^ permalink  raw  reply  [nested|flat] 16+ messages in thread

*  Re: BUG #17148: About --no-strict-names option and --quiet option of pg_amcheck command
@ 2021-08-17 14:53  Euler Taveira <euler@eulerto.com>
  parent: Daniel Gustafsson <daniel@yesql.se>
  0 siblings, 1 reply; 16+ messages in thread

From: Euler Taveira @ 2021-08-17 14:53 UTC (permalink / raw)
  To: Daniel Gustafsson <daniel@yesql.se>; chenjq.jy@fujitsu.com; pgsql-bugs@lists.postgresql.org; +Cc: Julien Rouhaud <rjuju123@gmail.com>

On Tue, Aug 17, 2021, at 8:06 AM, Daniel Gustafsson wrote:
> Julien Rouhaud also pointed out off-list that the help output and documentation
> aren't in agreement about how --quiet works. In the documentation we say:
> 
> "Print fewer messages, and less detail regarding any server errors."
> 
> But the help output takes a stronger position on this:
> 
> $ ./bin/pg_amcheck --help |grep quiet
>   -q, --quiet                     don't write any messages
> 
> The latter isn't entirely true IMO, so I think we should reconcile them with
> something like this while in here and fixing things anyways:
I suggest that it should be a message that we already use in another binaries
such as "do not print any output, except for errors". This message is probably
more accurate than "don't write any messages" even for the other binaries
(clusterdb, reindexdb, and vacuumdb) too.

For example, vacuumdb prints an error message even though --quiet is provided.

$ vacuumdb -d postgres -p 8888 --quiet
vacuumdb: error: connection to server on socket "/tmp/.s.PGSQL.8888" failed: No such file or directory
Is the server running locally and accepting connections on that socket?

quiet option is not strict; it doesn't omit *all* messages (including fatal or
error messages). We can debate if the current behavior is fine for most use
cases. It might surprise users while writing a script that they should discard
the standard error output even though the command contains a --quiet option.

That's a different (but related) patch but IMO we should change the --help
description because it is (a) not accurate and (b) doesn't match the
documentation: "don't write any messages" vs "Do not display progress
messages".


--
Euler Taveira
EDB   https://www.enterprisedb.com/

^ permalink  raw  reply  [nested|flat] 16+ messages in thread

* Re: BUG #17148: About --no-strict-names option and --quiet option of pg_amcheck command
@ 2021-08-17 15:57  Daniel Gustafsson <daniel@yesql.se>
  parent: Euler Taveira <euler@eulerto.com>
  0 siblings, 1 reply; 16+ messages in thread

From: Daniel Gustafsson @ 2021-08-17 15:57 UTC (permalink / raw)
  To: Euler Taveira <euler@eulerto.com>; +Cc: chenjq.jy@fujitsu.com, pgsql-bugs@lists.postgresql.org, Julien Rouhaud <rjuju123@gmail.com>

> On 17 Aug 2021, at 16:53, Euler Taveira <euler@eulerto.com> wrote:
> On Tue, Aug 17, 2021, at 8:06 AM, Daniel Gustafsson wrote:

>> ..I think we should reconcile them with
>> something like this while in here and fixing things anyways:

> I suggest that it should be a message that we already use in another binaries
> such as "do not print any output, except for errors".

Well, problem is that it’s plain not true.  If you pass --quiet --verbose you
will get a lot of output, albeit less than if not using --quiet.  Consistency
with other tools is obviously good, but only when it’s correct IMO.

--
Daniel Gustafsson		https://vmware.com/






^ permalink  raw  reply  [nested|flat] 16+ messages in thread

*  Re: BUG #17148: About --no-strict-names option and --quiet option of pg_amcheck command
@ 2021-08-17 17:00  Euler Taveira <euler@eulerto.com>
  parent: Daniel Gustafsson <daniel@yesql.se>
  0 siblings, 1 reply; 16+ messages in thread

From: Euler Taveira @ 2021-08-17 17:00 UTC (permalink / raw)
  To: Daniel Gustafsson <daniel@yesql.se>; +Cc: chenjq.jy@fujitsu.com, pgsql-bugs@lists.postgresql.org, "Julien Rouhaud" <rjuju123@gmail.com>



On Tue, Aug 17, 2021, at 12:57 PM, Daniel Gustafsson wrote:
> > On 17 Aug 2021, at 16:53, Euler Taveira <euler@eulerto.com> wrote:
> > On Tue, Aug 17, 2021, at 8:06 AM, Daniel Gustafsson wrote:
> 
> >> ..I think we should reconcile them with
> >> something like this while in here and fixing things anyways:
> 
> > I suggest that it should be a message that we already use in another binaries
> > such as "do not print any output, except for errors".
> 
> Well, problem is that it’s plain not true.  If you pass --quiet --verbose you
> will get a lot of output, albeit less than if not using --quiet.  Consistency
> with other tools is obviously good, but only when it’s correct IMO.
Indeed, it is not a good design. It should be one option --verbose that
increases the verbosity according to a number or an enum value. --verbose=0
means "quiet". However, that ship has sailed.


--
Euler Taveira
EDB   https://www.enterprisedb.com/

^ permalink  raw  reply  [nested|flat] 16+ messages in thread

* Re: BUG #17148: About --no-strict-names option and --quiet option of pg_amcheck command
@ 2021-08-18 11:44  Peter Eisentraut <peter.eisentraut@enterprisedb.com>
  parent: Euler Taveira <euler@eulerto.com>
  0 siblings, 1 reply; 16+ messages in thread

From: Peter Eisentraut @ 2021-08-18 11:44 UTC (permalink / raw)
  To: Euler Taveira <euler@eulerto.com>; Daniel Gustafsson <daniel@yesql.se>; +Cc: chenjq.jy@fujitsu.com, pgsql-bugs@lists.postgresql.org, Julien Rouhaud <rjuju123@gmail.com>

On 17.08.21 19:00, Euler Taveira wrote:
>> Well, problem is that it’s plain not true.  If you pass --quiet 
>> --verbose you
>> will get a lot of output, albeit less than if not using --quiet.  
>> Consistency
>> with other tools is obviously good, but only when it’s correct IMO.
> Indeed, it is not a good design. It should be one option --verbose that
> increases the verbosity according to a number or an enum value. --verbose=0
> means "quiet". However, that ship has sailed.

I was confused by this the other day as well.  Having all of

   -q, --quiet                     don't write any messages
   -P, --progress                  show progress information
   -v, --verbose                   write a lot of output

is surely a lot.

If you look at what --quiet does, it

1) disables logging warnings if there are no matches for object patterns 
and --no-strict-names is given, and

2) sets PQsetErrorVerbosity(free_slot->connection, PQERRORS_TERSE).

I think this both of these things could be deleted and we could get rid 
of the --quiet option, to simplify all this.  Neither of these behaviors 
is in common with any other PostgreSQL tool.





^ permalink  raw  reply  [nested|flat] 16+ messages in thread

* Re: BUG #17148: About --no-strict-names option and --quiet option of pg_amcheck command
@ 2021-08-18 12:35  Daniel Gustafsson <daniel@yesql.se>
  parent: Peter Eisentraut <peter.eisentraut@enterprisedb.com>
  0 siblings, 1 reply; 16+ messages in thread

From: Daniel Gustafsson @ 2021-08-18 12:35 UTC (permalink / raw)
  To: Peter Eisentraut <peter.eisentraut@enterprisedb.com>; +Cc: Euler Taveira <euler@eulerto.com>; chenjq.jy@fujitsu.com, pgsql-bugs@lists.postgresql.org, Julien Rouhaud <rjuju123@gmail.com>

> On 18 Aug 2021, at 13:44, Peter Eisentraut <peter.eisentraut@enterprisedb.com> wrote:

> I think this both of these things could be deleted and we could get rid of the --quiet option, to simplify all this. 

It simplifies the pg_amcheck code a bit, but it at the same time complicates
the tests as they are currently written.  Not sure that we want to change that
much as this point in the 14 cycle?

> Neither of these behaviors is in common with any other PostgreSQL tool.

That I agree with.

--
Daniel Gustafsson		https://vmware.com/






^ permalink  raw  reply  [nested|flat] 16+ messages in thread

* Re: BUG #17148: About --no-strict-names option and --quiet option of pg_amcheck command
@ 2021-08-18 13:42  Tom Lane <tgl@sss.pgh.pa.us>
  parent: Daniel Gustafsson <daniel@yesql.se>
  0 siblings, 1 reply; 16+ messages in thread

From: Tom Lane @ 2021-08-18 13:42 UTC (permalink / raw)
  To: Daniel Gustafsson <daniel@yesql.se>; +Cc: Peter Eisentraut <peter.eisentraut@enterprisedb.com>; Euler Taveira <euler@eulerto.com>; chenjq.jy@fujitsu.com, pgsql-bugs@lists.postgresql.org, Julien Rouhaud <rjuju123@gmail.com>

Daniel Gustafsson <daniel@yesql.se> writes:
>> On 18 Aug 2021, at 13:44, Peter Eisentraut <peter.eisentraut@enterprisedb.com> wrote:
>> I think this both of these things could be deleted and we could get rid of the --quiet option, to simplify all this. 

> It simplifies the pg_amcheck code a bit, but it at the same time complicates
> the tests as they are currently written.  Not sure that we want to change that
> much as this point in the 14 cycle?

It's going to become much harder to change pg_amcheck's user-visible
behavior once it's shipped in a release.  Better to fix it now while
there are not backwards-compatibility concerns.

			regards, tom lane





^ permalink  raw  reply  [nested|flat] 16+ messages in thread

* Re: BUG #17148: About --no-strict-names option and --quiet option of pg_amcheck command
@ 2021-08-18 13:46  Magnus Hagander <magnus@hagander.net>
  parent: Tom Lane <tgl@sss.pgh.pa.us>
  0 siblings, 1 reply; 16+ messages in thread

From: Magnus Hagander @ 2021-08-18 13:46 UTC (permalink / raw)
  To: Tom Lane <tgl@sss.pgh.pa.us>; +Cc: Daniel Gustafsson <daniel@yesql.se>; Peter Eisentraut <peter.eisentraut@enterprisedb.com>; Euler Taveira <euler@eulerto.com>; chenjq.jy@fujitsu.com, PostgreSQL mailing lists <pgsql-bugs@lists.postgresql.org>; Julien Rouhaud <rjuju123@gmail.com>

On Wed, Aug 18, 2021 at 3:43 PM Tom Lane <tgl@sss.pgh.pa.us> wrote:
>
> Daniel Gustafsson <daniel@yesql.se> writes:
> >> On 18 Aug 2021, at 13:44, Peter Eisentraut <peter.eisentraut@enterprisedb.com> wrote:
> >> I think this both of these things could be deleted and we could get rid of the --quiet option, to simplify all this.
>
> > It simplifies the pg_amcheck code a bit, but it at the same time complicates
> > the tests as they are currently written.  Not sure that we want to change that
> > much as this point in the 14 cycle?
>
> It's going to become much harder to change pg_amcheck's user-visible
> behavior once it's shipped in a release.  Better to fix it now while
> there are not backwards-compatibility concerns.

+<several>. Let's just get it done now. I doubt many people have had
the time to integrate it into their scripts and such yet, and since
it's a beta...

-- 
 Magnus Hagander
 Me: https://www.hagander.net/
 Work: https://www.redpill-linpro.com/





^ permalink  raw  reply  [nested|flat] 16+ messages in thread

* Re: BUG #17148: About --no-strict-names option and --quiet option of pg_amcheck command
@ 2021-08-18 13:49  Daniel Gustafsson <daniel@yesql.se>
  parent: Magnus Hagander <magnus@hagander.net>
  0 siblings, 1 reply; 16+ messages in thread

From: Daniel Gustafsson @ 2021-08-18 13:49 UTC (permalink / raw)
  To: Magnus Hagander <magnus@hagander.net>; +Cc: Tom Lane <tgl@sss.pgh.pa.us>; Peter Eisentraut <peter.eisentraut@enterprisedb.com>; Euler Taveira <euler@eulerto.com>; chenjq.jy@fujitsu.com, PostgreSQL mailing lists <pgsql-bugs@lists.postgresql.org>; Julien Rouhaud <rjuju123@gmail.com>

> On 18 Aug 2021, at 15:46, Magnus Hagander <magnus@hagander.net> wrote:
> 
> On Wed, Aug 18, 2021 at 3:43 PM Tom Lane <tgl@sss.pgh.pa.us> wrote:
>> 
>> Daniel Gustafsson <daniel@yesql.se> writes:
>>>> On 18 Aug 2021, at 13:44, Peter Eisentraut <peter.eisentraut@enterprisedb.com> wrote:
>>>> I think this both of these things could be deleted and we could get rid of the --quiet option, to simplify all this.
>> 
>>> It simplifies the pg_amcheck code a bit, but it at the same time complicates
>>> the tests as they are currently written.  Not sure that we want to change that
>>> much as this point in the 14 cycle?
>> 
>> It's going to become much harder to change pg_amcheck's user-visible
>> behavior once it's shipped in a release.  Better to fix it now while
>> there are not backwards-compatibility concerns.
> 
> +<several>. Let's just get it done now. I doubt many people have had
> the time to integrate it into their scripts and such yet, and since
> it's a beta...

Since there is consensus for removing --quiet, I’ll propose a patch in a bit
for removing it and fixing up the tests.

--
Daniel Gustafsson		https://vmware.com/






^ permalink  raw  reply  [nested|flat] 16+ messages in thread

* Re: BUG #17148: About --no-strict-names option and --quiet option of pg_amcheck command
@ 2021-08-18 18:53  Daniel Gustafsson <daniel@yesql.se>
  parent: Daniel Gustafsson <daniel@yesql.se>
  0 siblings, 1 reply; 16+ messages in thread

From: Daniel Gustafsson @ 2021-08-18 18:53 UTC (permalink / raw)
  To: Magnus Hagander <magnus@hagander.net>; +Cc: Tom Lane <tgl@sss.pgh.pa.us>; Peter Eisentraut <peter.eisentraut@enterprisedb.com>; Euler Taveira <euler@eulerto.com>; chenjq.jy@fujitsu.com, PostgreSQL mailing lists <pgsql-bugs@lists.postgresql.org>; Julien Rouhaud <rjuju123@gmail.com>

> On 18 Aug 2021, at 15:49, Daniel Gustafsson <daniel@yesql.se> wrote:
> 
>> On 18 Aug 2021, at 15:46, Magnus Hagander <magnus@hagander.net> wrote:
>> 
>> On Wed, Aug 18, 2021 at 3:43 PM Tom Lane <tgl@sss.pgh.pa.us> wrote:
>>> 
>>> Daniel Gustafsson <daniel@yesql.se> writes:
>>>>> On 18 Aug 2021, at 13:44, Peter Eisentraut <peter.eisentraut@enterprisedb.com> wrote:
>>>>> I think this both of these things could be deleted and we could get rid of the --quiet option, to simplify all this.
>>> 
>>>> It simplifies the pg_amcheck code a bit, but it at the same time complicates
>>>> the tests as they are currently written.  Not sure that we want to change that
>>>> much as this point in the 14 cycle?
>>> 
>>> It's going to become much harder to change pg_amcheck's user-visible
>>> behavior once it's shipped in a release.  Better to fix it now while
>>> there are not backwards-compatibility concerns.
>> 
>> +<several>. Let's just get it done now. I doubt many people have had
>> the time to integrate it into their scripts and such yet, and since
>> it's a beta...
> 
> Since there is consensus for removing --quiet, I’ll propose a patch in a bit
> for removing it and fixing up the tests.

Turns I was a bit undercaffeinated when skimming the tests, it really wasn’t
that invasive.  The attached diff removes --quiet and fixes up the tests and
docs to match.  Anyone who wants to keep --quiet should..  ehm, not keep quiet.

--
Daniel Gustafsson		https://vmware.com/

Attachments:

pg_amcheck_no_quiet.diff (application/octet-stream, 6.7K) download diff --git a/doc/src/sgml/ref/pg_amcheck.sgml b/doc/src/sgml/ref/pg_amcheck.sgml index 46d12110b1..d00c48d0e7 100644 --- a/doc/src/sgml/ref/pg_amcheck.sgml +++ b/doc/src/sgml/ref/pg_amcheck.sgml @@ -289,8 +289,6 @@ PostgreSQL documentation <literal>--table</literal>, <literal>--index</literal>, or <literal>--relation</literal> matches no objects, it is a fatal error. This option downgrades that error to a warning. - If this option is used with <literal>--quiet</literal>, the warning - will be suppressed as well. </para> </listitem> </varlistentry> @@ -553,16 +551,6 @@ PostgreSQL documentation </listitem> </varlistentry> - <varlistentry> - <term><option>-q</option></term> - <term><option>--quiet</option></term> - <listitem> - <para> - Print fewer messages, and less detail regarding any server errors. - </para> - </listitem> - </varlistentry> - <varlistentry> <term><option>-P</option></term> <term><option>--progress</option></term> diff --git a/src/bin/pg_amcheck/pg_amcheck.c b/src/bin/pg_amcheck/pg_amcheck.c index a86a1c0987..4498632d21 100644 --- a/src/bin/pg_amcheck/pg_amcheck.c +++ b/src/bin/pg_amcheck/pg_amcheck.c @@ -56,7 +56,6 @@ typedef struct AmcheckOptions bool dbpattern; bool alldb; bool echo; - bool quiet; bool verbose; bool strict_names; bool show_progress; @@ -112,7 +111,6 @@ static AmcheckOptions opts = { .dbpattern = false, .alldb = false, .echo = false, - .quiet = false, .verbose = false, .strict_names = true, .show_progress = false, @@ -250,7 +248,6 @@ main(int argc, char *argv[]) {"exclude-index", required_argument, NULL, 'I'}, {"jobs", required_argument, NULL, 'j'}, {"progress", no_argument, NULL, 'P'}, - {"quiet", no_argument, NULL, 'q'}, {"relation", required_argument, NULL, 'r'}, {"exclude-relation", required_argument, NULL, 'R'}, {"schema", required_argument, NULL, 's'}, @@ -294,7 +291,7 @@ main(int argc, char *argv[]) handle_help_version_opts(argc, argv, progname, help); /* process command-line options */ - while ((c = getopt_long(argc, argv, "ad:D:eh:Hi:I:j:p:Pqr:R:s:S:t:T:U:wWv", + while ((c = getopt_long(argc, argv, "ad:D:eh:Hi:I:j:p:Pr:R:s:S:t:T:U:wWv", long_options, &optindex)) != -1) { char *endptr; @@ -337,9 +334,6 @@ main(int argc, char *argv[]) case 'P': opts.show_progress = true; break; - case 'q': - opts.quiet = true; - break; case 'r': opts.allrel = false; append_relation_pattern(&opts.include, optarg, encoding); @@ -632,21 +626,18 @@ main(int argc, char *argv[]) { failed = opts.strict_names; - if (!opts.quiet || failed) - { - if (pat->heap_only) - log_no_match("no heap tables to check matching \"%s\"", - pat->pattern); - else if (pat->btree_only) - log_no_match("no btree indexes to check matching \"%s\"", - pat->pattern); - else if (pat->rel_regex == NULL) - log_no_match("no relations to check in schemas matching \"%s\"", - pat->pattern); - else - log_no_match("no relations to check matching \"%s\"", - pat->pattern); - } + if (pat->heap_only) + log_no_match("no heap tables to check matching \"%s\"", + pat->pattern); + else if (pat->btree_only) + log_no_match("no btree indexes to check matching \"%s\"", + pat->pattern); + else if (pat->rel_regex == NULL) + log_no_match("no relations to check in schemas matching \"%s\"", + pat->pattern); + else + log_no_match("no relations to check matching \"%s\"", + pat->pattern); } } @@ -744,8 +735,6 @@ main(int argc, char *argv[]) if (opts.verbose) PQsetErrorVerbosity(free_slot->connection, PQERRORS_VERBOSE); - else if (opts.quiet) - PQsetErrorVerbosity(free_slot->connection, PQERRORS_TERSE); /* * Execute the appropriate amcheck command for this relation using our @@ -1187,7 +1176,6 @@ help(const char *progname) printf(_("\nOther options:\n")); printf(_(" -e, --echo show the commands being sent to the server\n")); printf(_(" -j, --jobs=NUM use this many concurrent connections to the server\n")); - printf(_(" -q, --quiet don't write any messages\n")); printf(_(" -P, --progress show progress information\n")); printf(_(" -v, --verbose write a lot of output\n")); printf(_(" -V, --version output version information, then exit\n")); diff --git a/src/bin/pg_amcheck/t/002_nonesuch.pl b/src/bin/pg_amcheck/t/002_nonesuch.pl index 5417959553..e30c1cc546 100644 --- a/src/bin/pg_amcheck/t/002_nonesuch.pl +++ b/src/bin/pg_amcheck/t/002_nonesuch.pl @@ -6,7 +6,7 @@ use warnings; use PostgresNode; use TestLib; -use Test::More tests => 72; +use Test::More tests => 76; # Test set-up my ($node, $port); @@ -191,6 +191,10 @@ $node->command_checks_all( qr/pg_amcheck: warning: no relations to check matching "postgres\.long\.dotted\.string"/, qr/pg_amcheck: warning: no relations to check matching "postgres\.pg_catalog\.none"/, qr/pg_amcheck: warning: no relations to check matching "postgres\.none\.pg_class"/, + qr/pg_amcheck: warning: no connectable databases to check matching "no_such_database"/, + qr/pg_amcheck: warning: no connectable databases to check matching "no\*such\*database"/, + qr/pg_amcheck: warning: no connectable databases to check matching "none\.none\.none"/, + qr/pg_amcheck: warning: no connectable databases to check matching "this\.is\.a\.really\.long\.dotted\.string"/, ], 'many unmatched patterns and one matched pattern under --no-strict-names' ); diff --git a/src/bin/pg_amcheck/t/003_check.pl b/src/bin/pg_amcheck/t/003_check.pl index f3eb41ce3a..c26e5eda67 100644 --- a/src/bin/pg_amcheck/t/003_check.pl +++ b/src/bin/pg_amcheck/t/003_check.pl @@ -317,7 +317,7 @@ plan_to_remove_relation_file('db2', 's1.t1_btree'); # # Standard first arguments to TestLib functions -my @cmd = ('pg_amcheck', '--quiet', '-p', $port); +my @cmd = ('pg_amcheck', '-p', $port); # Regular expressions to match various expected output my $no_output_re = qr/^$/; diff --git a/src/bin/pg_amcheck/t/005_opclass_damage.pl b/src/bin/pg_amcheck/t/005_opclass_damage.pl index 806335375d..e87d81d7d4 100644 --- a/src/bin/pg_amcheck/t/005_opclass_damage.pl +++ b/src/bin/pg_amcheck/t/005_opclass_damage.pl @@ -34,7 +34,7 @@ $node->safe_psql( # We have not yet broken the index, so we should get no corruption $node->command_like( - [ 'pg_amcheck', '--quiet', '-p', $node->port, 'postgres' ], + [ 'pg_amcheck', '-p', $node->port, 'postgres' ], qr/^$/, 'pg_amcheck all schemas, tables and indexes reports no corruption');
^ permalink raw reply [nested|flat] 16+ messages in thread

* Re: BUG #17148: About --no-strict-names option and --quiet option of pg_amcheck command
@ 2021-08-19 02:45  Julien Rouhaud <rjuju123@gmail.com>
  parent: Daniel Gustafsson <daniel@yesql.se>
  0 siblings, 1 reply; 16+ messages in thread

From: Julien Rouhaud @ 2021-08-19 02:45 UTC (permalink / raw)
  To: Daniel Gustafsson <daniel@yesql.se>; +Cc: Magnus Hagander <magnus@hagander.net>; Tom Lane <tgl@sss.pgh.pa.us>; Peter Eisentraut <peter.eisentraut@enterprisedb.com>; Euler Taveira <euler@eulerto.com>; chenjq.jy@fujitsu.com, PostgreSQL mailing lists <pgsql-bugs@lists.postgresql.org>

On Thu, Aug 19, 2021 at 2:53 AM Daniel Gustafsson <daniel@yesql.se> wrote:
>
> > On 18 Aug 2021, at 15:49, Daniel Gustafsson <daniel@yesql.se> wrote:
> >
> > Since there is consensus for removing --quiet, I’ll propose a patch in a bit
> > for removing it and fixing up the tests.
>
> Turns I was a bit undercaffeinated when skimming the tests, it really wasn’t
> that invasive.  The attached diff removes --quiet and fixes up the tests and
> docs to match.  Anyone who wants to keep --quiet should..  ehm, not keep quiet.

The patch looks good to me.





^ permalink  raw  reply  [nested|flat] 16+ messages in thread

* Re: BUG #17148: About --no-strict-names option and --quiet option of pg_amcheck command
@ 2021-08-20 10:49  Daniel Gustafsson <daniel@yesql.se>
  parent: Julien Rouhaud <rjuju123@gmail.com>
  0 siblings, 1 reply; 16+ messages in thread

From: Daniel Gustafsson @ 2021-08-20 10:49 UTC (permalink / raw)
  To: Julien Rouhaud <rjuju123@gmail.com>; +Cc: Magnus Hagander <magnus@hagander.net>; Tom Lane <tgl@sss.pgh.pa.us>; Peter Eisentraut <peter.eisentraut@enterprisedb.com>; Euler Taveira <euler@eulerto.com>; chenjq.jy@fujitsu.com, PostgreSQL mailing lists <pgsql-bugs@lists.postgresql.org>

> On 19 Aug 2021, at 04:45, Julien Rouhaud <rjuju123@gmail.com> wrote:
> 
> On Thu, Aug 19, 2021 at 2:53 AM Daniel Gustafsson <daniel@yesql.se> wrote:
>> 
>>> On 18 Aug 2021, at 15:49, Daniel Gustafsson <daniel@yesql.se> wrote:
>>> 
>>> Since there is consensus for removing --quiet, I’ll propose a patch in a bit
>>> for removing it and fixing up the tests.
>> 
>> Turns I was a bit undercaffeinated when skimming the tests, it really wasn’t
>> that invasive.  The attached diff removes --quiet and fixes up the tests and
>> docs to match.  Anyone who wants to keep --quiet should..  ehm, not keep quiet.
> 
> The patch looks good to me.

Applied to master and 14, thanks for review!

--
Daniel Gustafsson		https://vmware.com/






^ permalink  raw  reply  [nested|flat] 16+ messages in thread

* Re: BUG #17148: About --no-strict-names option and --quiet option of pg_amcheck command
@ 2021-08-27 11:21  Peter Eisentraut <peter.eisentraut@enterprisedb.com>
  parent: Daniel Gustafsson <daniel@yesql.se>
  0 siblings, 1 reply; 16+ messages in thread

From: Peter Eisentraut @ 2021-08-27 11:21 UTC (permalink / raw)
  To: Daniel Gustafsson <daniel@yesql.se>; Julien Rouhaud <rjuju123@gmail.com>; +Cc: Magnus Hagander <magnus@hagander.net>; Tom Lane <tgl@sss.pgh.pa.us>; Euler Taveira <euler@eulerto.com>; chenjq.jy@fujitsu.com, PostgreSQL mailing lists <pgsql-bugs@lists.postgresql.org>

On 20.08.21 12:49, Daniel Gustafsson wrote:
>> On 19 Aug 2021, at 04:45, Julien Rouhaud <rjuju123@gmail.com> wrote:
>>
>> On Thu, Aug 19, 2021 at 2:53 AM Daniel Gustafsson <daniel@yesql.se> wrote:
>>>
>>>> On 18 Aug 2021, at 15:49, Daniel Gustafsson <daniel@yesql.se> wrote:
>>>>
>>>> Since there is consensus for removing --quiet, I’ll propose a patch in a bit
>>>> for removing it and fixing up the tests.
>>>
>>> Turns I was a bit undercaffeinated when skimming the tests, it really wasn’t
>>> that invasive.  The attached diff removes --quiet and fixes up the tests and
>>> docs to match.  Anyone who wants to keep --quiet should..  ehm, not keep quiet.
>>
>> The patch looks good to me.
> 
> Applied to master and 14, thanks for review!

I see that we still have the PQsetErrorVerbosity() call for --verbose, 
and we still issue warnings with --no-strict-names.  Did we want to keep 
these two behaviors?





^ permalink  raw  reply  [nested|flat] 16+ messages in thread

* Re: BUG #17148: About --no-strict-names option and --quiet option of pg_amcheck command
@ 2021-08-27 12:02  Daniel Gustafsson <daniel@yesql.se>
  parent: Peter Eisentraut <peter.eisentraut@enterprisedb.com>
  0 siblings, 0 replies; 16+ messages in thread

From: Daniel Gustafsson @ 2021-08-27 12:02 UTC (permalink / raw)
  To: Peter Eisentraut <peter.eisentraut@enterprisedb.com>; +Cc: Julien Rouhaud <rjuju123@gmail.com>; Magnus Hagander <magnus@hagander.net>; Tom Lane <tgl@sss.pgh.pa.us>; Euler Taveira <euler@eulerto.com>; chenjq.jy@fujitsu.com, PostgreSQL mailing lists <pgsql-bugs@lists.postgresql.org>

> On 27 Aug 2021, at 13:21, Peter Eisentraut <peter.eisentraut@enterprisedb.com> wrote:
> 
> On 20.08.21 12:49, Daniel Gustafsson wrote:
>>> On 19 Aug 2021, at 04:45, Julien Rouhaud <rjuju123@gmail.com> wrote:
>>> 
>>> On Thu, Aug 19, 2021 at 2:53 AM Daniel Gustafsson <daniel@yesql.se> wrote:
>>>> 
>>>>> On 18 Aug 2021, at 15:49, Daniel Gustafsson <daniel@yesql.se> wrote:
>>>>> 
>>>>> Since there is consensus for removing --quiet, I’ll propose a patch in a bit
>>>>> for removing it and fixing up the tests.
>>>> 
>>>> Turns I was a bit undercaffeinated when skimming the tests, it really wasn’t
>>>> that invasive.  The attached diff removes --quiet and fixes up the tests and
>>>> docs to match.  Anyone who wants to keep --quiet should..  ehm, not keep quiet.
>>> 
>>> The patch looks good to me.
>> Applied to master and 14, thanks for review!
> 
> I see that we still have the PQsetErrorVerbosity() call for --verbose, and we still issue warnings with --no-strict-names.  Did we want to keep these two behaviors?

I think issuing the warnings for --no-strict-names is appropriate, setting
PQsetErrorVerbosity on --verbose might be less so although I don’t strong
feelings on that.  Maybe setting that should be reserved for the extra verbose
levels (that many other projects have with -vv etc) if we ever add that?

--
Daniel Gustafsson		https://vmware.com/






^ permalink  raw  reply  [nested|flat] 16+ messages in thread


end of thread, other threads:[~2021-08-27 12:02 UTC | newest]

Thread overview: 16+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2021-08-17 04:34 BUG #17148: About --no-strict-names option and --quiet option of pg_amcheck command PG Bug reporting form <noreply@postgresql.org>
2021-08-17 08:14 ` Daniel Gustafsson <daniel@yesql.se>
2021-08-17 11:06   ` Daniel Gustafsson <daniel@yesql.se>
2021-08-17 14:53     ` Euler Taveira <euler@eulerto.com>
2021-08-17 15:57       ` Daniel Gustafsson <daniel@yesql.se>
2021-08-17 17:00         ` Euler Taveira <euler@eulerto.com>
2021-08-18 11:44           ` Peter Eisentraut <peter.eisentraut@enterprisedb.com>
2021-08-18 12:35             ` Daniel Gustafsson <daniel@yesql.se>
2021-08-18 13:42               ` Tom Lane <tgl@sss.pgh.pa.us>
2021-08-18 13:46                 ` Magnus Hagander <magnus@hagander.net>
2021-08-18 13:49                   ` Daniel Gustafsson <daniel@yesql.se>
2021-08-18 18:53                     ` Daniel Gustafsson <daniel@yesql.se>
2021-08-19 02:45                       ` Julien Rouhaud <rjuju123@gmail.com>
2021-08-20 10:49                         ` Daniel Gustafsson <daniel@yesql.se>
2021-08-27 11:21                           ` Peter Eisentraut <peter.eisentraut@enterprisedb.com>
2021-08-27 12:02                             ` Daniel Gustafsson <daniel@yesql.se>

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox