Improve error reporting for few options in pg_createsubscriber

Started by vignesh Cover 1 year ago5 messageshackers
Jump to latest
#1vignesh C
vignesh21@gmail.com

Hi,

Currently, error reports for database, publication, subscription, and
replication slots do not include the option name. This has been
addressed by including the option name in the error messages, ensuring
consistency similar to remove option. Additionally, pg_log_error and
exit(1) have been replaced with a single pg_fatal statement which
means the same. The attached patch implements these changes.

Regards,
Vignesh

Attachments:

0001-Improve-error-reporting-consistency-in-pg_createsubs.patchtext/x-patch; charset=US-ASCII; name=0001-Improve-error-reporting-consistency-in-pg_createsubs.patchDownload+4-17
#2Hayato Kuroda (Fujitsu)
kuroda.hayato@fujitsu.com
In reply to: vignesh C (#1)
RE: Improve error reporting for few options in pg_createsubscriber

Dear Vignesh,

Currently, error reports for database, publication, subscription, and
replication slots do not include the option name. This has been
addressed by including the option name in the error messages, ensuring
consistency similar to remove option.

Confirmed all error reporting in switch have its option name.

Additionally, pg_log_error and
exit(1) have been replaced with a single pg_fatal statement which
means the same. The attached patch implements these changes.

I grepped source and confirmed that exit(1) just after pg_log_error()
does not exist anymore. Several lines have below style, but IIUC it is
out-of-scope of the patch.

pg_log_error();
pg_log_error_hint();
exit(1);

Best regards,
Hayato Kuroda
FUJITSU LIMITED

#3Amit Kapila
amit.kapila16@gmail.com
In reply to: vignesh C (#1)
Re: Improve error reporting for few options in pg_createsubscriber

On Sat, Mar 22, 2025 at 7:26 PM vignesh C <vignesh21@gmail.com> wrote:

Hi,

Currently, error reports for database, publication, subscription, and
replication slots do not include the option name. This has been
addressed by including the option name in the error messages, ensuring
consistency similar to remove option. Additionally, pg_log_error and
exit(1) have been replaced with a single pg_fatal statement which
means the same. The attached patch implements these changes.

A few comments:
*
pg_createsubscriber.exe -D ..\..\data_standby -d db1 -d db2 -d db1
--publication pub1 --publication pub1 -P "dbname=postgres port=5432"
-p 5444 --dry-run
pg_createsubscriber: error: database "db1" specified more than once
for --database

Even when user has used short form, we are displaying long form for
database. I suggest to use both short and long form where applicable.

*
"invalid object type \"%s\" specified for --remove". Isn't it better
to use the short form as well in this error message?

--
With Regards,
Amit Kapila.

#4vignesh C
vignesh21@gmail.com
In reply to: Amit Kapila (#3)
Re: Improve error reporting for few options in pg_createsubscriber

On Fri, 4 Apr 2025 at 09:36, Amit Kapila <amit.kapila16@gmail.com> wrote:

A few comments:
*
pg_createsubscriber.exe -D ..\..\data_standby -d db1 -d db2 -d db1
--publication pub1 --publication pub1 -P "dbname=postgres port=5432"
-p 5444 --dry-run
pg_createsubscriber: error: database "db1" specified more than once
for --database

Even when user has used short form, we are displaying long form for
database. I suggest to use both short and long form where applicable.

Fixed this.

*
"invalid object type \"%s\" specified for --remove". Isn't it better
to use the short form as well in this error message?

Fixed this.

The attached v2 version patch has the changes for the same.

Regards,
Vignesh

Attachments:

v2-0001-Improve-error-reporting-consistency-in-pg_creates.patchtext/x-patch; charset=US-ASCII; name=v2-0001-Improve-error-reporting-consistency-in-pg_creates.patchDownload+9-22
#5Amit Kapila
amit.kapila16@gmail.com
In reply to: vignesh C (#4)
Re: Improve error reporting for few options in pg_createsubscriber

On Fri, Apr 4, 2025 at 10:11 AM vignesh C <vignesh21@gmail.com> wrote:

On Fri, 4 Apr 2025 at 09:36, Amit Kapila <amit.kapila16@gmail.com> wrote:

The attached v2 version patch has the changes for the same.

Pushed.

--
With Regards,
Amit Kapila.