Re: Enhance 'pg_createsubscriber' to retrieve databases automatically when no database is provided.

From: Shubham Khanna <khannashubham1197(at)gmail(dot)com>
To: Ashutosh Bapat <ashutosh(dot)bapat(dot)oss(at)gmail(dot)com>
Cc: Amit Kapila <amit(dot)kapila16(at)gmail(dot)com>, Peter Smith <smithpb2250(at)gmail(dot)com>, PostgreSQL Hackers <pgsql-hackers(at)lists(dot)postgresql(dot)org>
Subject: Re: Enhance 'pg_createsubscriber' to retrieve databases automatically when no database is provided.
Date: 2025-02-04 19:55:45
Message-ID: CAHv8Rj+fMy2CmkTAoCnxxQ=fL_wjZosfuYeuF8bM5mzCShy5wQ@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On Tue, Feb 4, 2025 at 3:49 PM Ashutosh Bapat
<ashutosh(dot)bapat(dot)oss(at)gmail(dot)com> wrote:
>
> Hi Shubham,
>
> On Tue, Feb 4, 2025 at 2:10 PM Shubham Khanna
> <khannashubham1197(at)gmail(dot)com> wrote:
> > > >
> > >
> > > It could be a bit tricky to find that for users but they can devise a
> > > query to get the names and numbers of databases matching the given
> > > pattern. OTOH, I am not sure there is a clear need at this stage for
> > > pattern matching for this tool. So, we can go with a simple switch as
> > > you are proposing at this stage.
> > >
> >
> > After reconsidering the idea of supporting '--all-databases' switch is
> > the better approach at this stage, I have added the new switch in the
> > latest patch.
> > The attached patch contains the suggested changes.
>
> + If neither <option>-d</option> nor <option>-a</option> is
> + specified, <application>pg_createsubscriber</application> will use
> + <option>--all-databases</option> by default.
>
> As pointed upthread by me and Peter, using --all-databases by default
> is not a good behaviour.
>
> But the code doesn't behave like --all-databases by default. Looks
> like we need to fix the documentation.

Updated the documentation accordingly and added the current behaviour
of -a/--all-databases option.

> + /* Generate publication and slot names if not specified */
> + SimpleStringListCell *cell;
> +
> + fetch_all_databases(opt);
> +
> + cell = opt->database_names.head;
>
> We don't seem to check existence of publication and slot name
> specification as the comment indicates. Do we need to check that those
> names are not specified at all? and also mention in the documentation
> that those specifications are required when using -a/--all-databases
> option?
>

Added a check to verify that publication and slot names are not
manually specified when using -a/--all-databases option and updated
the documentation accordingly.

The attached patch contains the suggested changes.

Thanks and regards,
Shubham Khanna.

Attachment Content-Type Size
v3-0001-Enhance-pg_createsubscriber-to-fetch-and-append-a.patch application/octet-stream 12.3 KB

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Tom Lane 2025-02-04 19:56:22 Re: Better title output for psql \dt \di etc. commands
Previous Message Jeff Davis 2025-02-04 19:43:39 Re: should we have a fast-path planning for OLTP starjoins?