pg_recvlogical requires -d but not described on the documentation
Hayato Kuroda (Fujitsu) <kuroda.hayato@fujitsu.com>
From: "Hayato Kuroda (Fujitsu)" <kuroda.hayato@fujitsu.com>
To: "'pgsql-hackers@lists.postgresql.org'" <pgsql-hackers@lists.postgresql.org>
Date: 2025-02-21T04:25:43Z
Lists: pgsql-hackers
Attachments
- 0001-pg_recvlogical-accept-if-d-is-not-specified.patch (application/octet-stream) patch 0001
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
Commits
-
Allow pg_recvlogical --drop-slot to work without --dbname.
- c68100aa4313 18.0 landed
-
doc: Clarify required options for each action in pg_recvlogical.
- dfc13428a908 18.0 landed
-
Refactor replication connection code of various pg_basebackup utilities.
- 0c013e08cfbe 9.5.0 cited