pg_recvlogical requires -d but not described on the documentation

From: "Hayato Kuroda (Fujitsu)" <kuroda(dot)hayato(at)fujitsu(dot)com>
To: "'pgsql-hackers(at)lists(dot)postgresql(dot)org'" <pgsql-hackers(at)lists(dot)postgresql(dot)org>
Subject: pg_recvlogical requires -d but not described on the documentation
Date: 2025-02-21 04:25:43
Message-ID: OSCPR01MB14966930B4357BAE8C9D68A8AF5C72@OSCPR01MB14966.jpnprd01.prod.outlook.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Dear hackers,

Hi, I found the issue $SUBJECT. According to the doc [1]:

```
-d dbname
--dbname=dbname
The database to connect to. See the description of the actions for what this means in detail.
The dbname can be a connection string. If so, connection string parameters will override any
conflicting command line options. Defaults to the user name.
```

IIUC final statement implies --dbname can be omitted. If it is mandatory, it should be described
in the synopsis part - not written now. However, the command would fail when -d is missed.

```
$ pg_recvlogical -U postgres --start -S test -f -
pg_recvlogical: error: no database specified
pg_recvlogical: hint: Try "pg_recvlogical --help" for more information.
```

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.,

a) Use PGDATABASE if specified
b) Check 'U' and PGUSER and use it if specified
c) Otherwise use the current OS user name

Attached patch tries to implement the 2nd approach. How do you think?

[1]: https://www.postgresql.org/docs/devel/app-pgrecvlogical.html

Best regards,
Hayato Kuroda
FUJITSU LIMITED

Attachment Content-Type Size
0001-pg_recvlogical-accept-if-d-is-not-specified.patch application/octet-stream 2.2 KB

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message jian he 2025-02-21 04:43:41 Re: Virtual generated columns
Previous Message Ashutosh Bapat 2025-02-21 04:14:18 Re: Enhance 'pg_createsubscriber' to retrieve databases automatically when no database is provided.