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

From: Shubham Khanna <khannashubham1197(at)gmail(dot)com>
To: Amit Kapila <amit(dot)kapila16(at)gmail(dot)com>
Cc: Peter Smith <smithpb2250(at)gmail(dot)com>, Ashutosh Bapat <ashutosh(dot)bapat(dot)oss(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 08:39:56
Message-ID: CAHv8RjLUe0mczPubdkXbTQSawtOMd-p9BfUkr-d5aXpn9hnzWg@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On Thu, Jan 30, 2025 at 12:08 PM Amit Kapila <amit(dot)kapila16(at)gmail(dot)com> wrote:
>
> On Thu, Jan 30, 2025 at 6:21 AM Peter Smith <smithpb2250(at)gmail(dot)com> wrote:
> >
> > On Wed, Jan 29, 2025 at 4:44 PM Amit Kapila <amit(dot)kapila16(at)gmail(dot)com> wrote:
> > >
> > > On Tue, Jan 28, 2025 at 12:01 PM Ashutosh Bapat
> > > <ashutosh(dot)bapat(dot)oss(at)gmail(dot)com> wrote:
> > > >
> > > > If we want to stick to --database= supporting a pattern looks better
> > > > than just a single special pattern *.
> > > >
> > >
> > > This sounds reasonable to me as well. Note that the interaction of
> > > other parameters like --replication-slot is not yet discussed. I think
> > > if the number of slots given matches with the number of databases
> > > fetched based on pattern matches then we can use them otherwise,
> > > return the ERROR. The other option could be that we don't allow
> > > options like --replication-slot along with pattern matching option.
> > >
> >
> > I have had second thoughts about my pattern idea. Now, I favour just
> > adding another --all-databases switch like Ashutosh had suggested [1]
> > in the first place.
> >
> > I had overlooked the rules saying that the user is allowed to specify
> > *multiple* --publication or --replication-slot or --subscription name
> > switches, but when doing so they have to match the same number of
> > --database switches. Using a --dbname=pattern would be fraught with
> > complications. e.g. How can we know up-front how many databases the
> > dbname pattern will resolve to, and even in what order they get
> > resolved?
> >
>
> 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.

Thanks and regards,
Shubham Khanna.

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

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Bertrand Drouvot 2025-02-04 08:49:41 Re: per backend WAL statistics
Previous Message Masahiko Sawada 2025-02-04 08:15:29 Re: POC: enable logical decoding when wal_level = 'replica' without a server restart