Re: pg_recvlogical requires -d but not described on the documentation

vignesh C <vignesh21@gmail.com>

From: vignesh C <vignesh21@gmail.com>
To: "Hayato Kuroda (Fujitsu)" <kuroda.hayato@fujitsu.com>
Cc: Ashutosh Bapat <ashutosh.bapat.oss@gmail.com>, "pgsql-hackers@lists.postgresql.org" <pgsql-hackers@lists.postgresql.org>
Date: 2025-03-12T05:32:32Z
Lists: pgsql-hackers
On Fri, 21 Feb 2025 at 14:25, Hayato Kuroda (Fujitsu)
<kuroda.hayato@fujitsu.com> wrote:
>
> Dear Ashutosh,
>
> Thanks for the reply.
>
> > > ISTM the inconsistency is introduced since the initial commit. I think they should
> > be unified either
> > > 1) update the doc or 2) accept when -d is not specified. Personally, I like 2nd
> > approach, pg_recvlogical
> > > can follow the normal connection rule. I.e.,
> > >
> >
> > Given that the discrepancy has survived so long, it seems that users
> > always pass -d. And to some extent, requiring users to specify a
> > database instead of defaulting to one is safer practice. This avoids
> > users fetching changes from unexpected database/slot and cause further
> > database inconsistencies on the receiver side. I would just fix
> > documentation in this case.
>
> Something like attached, right?

Apart from the database, I believe the target file also needs to be
specified. Should we include this option also along with dbname:
+   <group choice="plain">
+    <group choice="req">
+     <arg choice="plain"><option>-d</option></arg>
+     <arg choice="plain"><option>--dbname</option></arg>
+    </group>
+    <replaceable>dbname</replaceable>
+   </group>

pg_recvlogical -U postgres --start -S test -d postgres
pg_recvlogical: error: no target file specified

Regards,
Vignesh



Commits

  1. Allow pg_recvlogical --drop-slot to work without --dbname.

  2. doc: Clarify required options for each action in pg_recvlogical.

  3. Refactor replication connection code of various pg_basebackup utilities.