Hi,

While looking at pg_recvlogical code, I noticed that a couple of error
messages are incorrect when invoking some combinations of --create,
--start or --drop.

For example, here --init should be --create, --stop should be --drop:
$ pg_recvlogical --create --drop --slot foo
pg_recvlogical: cannot use --init or --start together with --stop
Try "pg_recvlogical --help" for more information.

Also, when checking the combination startpos && (create || drop), I
think that we should check that startpos is InvalidXLogRecPtr.

The patch attached fixes all those things. It should be back-patched to 9.4.
Regards,
-- 
Michael
diff --git a/src/bin/pg_basebackup/pg_recvlogical.c b/src/bin/pg_basebackup/pg_recvlogical.c
index dbc002d..f3b0f34 100644
--- a/src/bin/pg_basebackup/pg_recvlogical.c
+++ b/src/bin/pg_basebackup/pg_recvlogical.c
@@ -814,15 +814,15 @@ main(int argc, char **argv)
 
 	if (do_drop_slot && (do_create_slot || do_start_slot))
 	{
-		fprintf(stderr, _("%s: cannot use --init or --start together with --stop\n"), progname);
+		fprintf(stderr, _("%s: cannot use --create or --start together with --drop\n"), progname);
 		fprintf(stderr, _("Try \"%s --help\" for more information.\n"),
 				progname);
 		exit(1);
 	}
 
-	if (startpos && (do_create_slot || do_drop_slot))
+	if (startpos != InvalidXLogRecPtr && (do_create_slot || do_drop_slot))
 	{
-		fprintf(stderr, _("%s: cannot use --init or --stop together with --startpos\n"), progname);
+		fprintf(stderr, _("%s: cannot use --create or --drop together with --startpos\n"), progname);
 		fprintf(stderr, _("Try \"%s --help\" for more information.\n"),
 				progname);
 		exit(1);
-- 
Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-hackers

Reply via email to