Re: Proposal: per-table row counts in pg_dump/pg_restore, with restore-time verification

From: Roberto Mello <roberto(dot)mello(at)gmail(dot)com>
To: pgsql-hackers(at)lists(dot)postgresql(dot)org
Cc: 6prensgold1(at)gmail(dot)com, guillaume(dot)lelarge(at)dalibo(dot)com
Subject: Re: Proposal: per-table row counts in pg_dump/pg_restore, with restore-time verification
Date: 2026-12-06 02:48:12
Message-ID: CAKz==bJoAxX5-bfh+Am=dJB_wuC6xfp=6Qwy-bO1FXvSR+VpNQ@mail.gmail.com
Views: Whole Thread | Raw Message | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Sönmez Başar wrote:
> 2. pg_restore --verbose, when restoring into a database: report the
> rows loaded per table, e.g.
> pg_restore: restored 10000 rows of table "public.orders"

Attached is a patch for step 2, against master 8d90516.

With --verbose, pg_restore now prints one line per table after its COPY
completes, e.g.

pg_restore: restored 10000 rows of table "orders_s.orders"

An empty table reports "restored 0 rows". The count is taken from the COPY
command tag. With --jobs, these lines interleave with the other tables'
messages.

I didn't cover data restored with INSERT commands (pg_dump --inserts,
--rows-per-insert) and script output (no -d). Neither prints a line but I
checked both.

Tests: 011_restore.pl now checks the count for the COPY cases (custom,
directory, tar), including an empty table, and that the --inserts and
--column-inserts cases print no such line. 004_pg_dump_parallel.pl checks
the count for a --jobs=3 restore. The positive checks fail without the C
change.

make check and the pg_dump TAP suite pass on 8d90516 (--enable-cassert
--enable-tap-tests). pgindent and perltidy report no changes.

I have not looked at step 1 (pg_dump) yet. It could follow the same pattern
if this is acceptable.

Roberto

Attachment Content-Type Size
v1-0001-pg_restore-Report-rows-restored-per-table-in-verb.patch text/x-patch 5.4 KB

In response to

Browse pgsql-hackers by date

  From Date Subject
Previous Message Roberto Mello 2026-12-06 02:26:43 Re: Requesting feedback on hybrid key exchange in Postgres