RE: [PATCH] pg_walsummary: suppress limit output with --quiet

From: "Hayato Kuroda (Fujitsu)" <kuroda(dot)hayato(at)fujitsu(dot)com>
To: "Koshi Shibagaki (Fujitsu)" <shibagaki(dot)koshi(at)fujitsu(dot)com>
Cc: "'pgsql-hackers(at)lists(dot)postgresql(dot)org'" <pgsql-hackers(at)lists(dot)postgresql(dot)org>
Subject: RE: [PATCH] pg_walsummary: suppress limit output with --quiet
Date: 2026-10-05 04:59:09
Message-ID: OS7PR01MB183176AA5500CEAD3D49092DBF5962@OS7PR01MB18317.jpnprd01.prod.outlook.com
Views: Whole Thread | Raw Message | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Hi Shibagaki-san,

Good catch!

> In dump_one_relation(), the limit line is printed before the existing
> quiet check. The attached patch adds a quiet check to that output while
> preserving parsing and error detection.

It might be matter of taste, but how about moving printf() after the `if (opt->quiet)`?
The code might be clearer.

> The patch also adds TAP coverage for -q and --quiet and checks that a
> truncated input file is still rejected. The pg_walsummary tests pass
> with the patch.

```
+# --quiet must also suppress limit blocks caused by relation creation.
+my $summary_dir = $node1->data_dir . '/pg_wal/summaries';
+my @summaries = map { "$summary_dir/$_" }
+ sort grep { /^[0-9A-F]{40}\.summary$/ } slurp_dir($summary_dir);
+command_like(
+ [ 'pg_walsummary', @summaries ],
+ qr/: limit 0$/m,
+ 'relation creation produces limit blocks');
+for my $option ('-q', '--quiet')
+{
+ command_checks_all(
+ [ 'pg_walsummary', $option, @summaries ],
+ 0,
+ [qr/\A\z/],
+ [qr/\A\z/],
+ "$option suppresses all output");
+}
```

I feel it's enough to call command_checks_all() once, thought?

Best regards,
Hayato Kuroda
FUJITSU LIMITED

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Nisha Moond 2026-10-05 05:25:55 Re: Proposal: Conflict log history table for Logical Replication
Previous Message Fujii Masao 2026-10-05 04:51:18 Re: [PATCH] pg_walsummary: suppress limit output with --quiet