From: | Shubham Khanna <khannashubham1197(at)gmail(dot)com> |
---|---|
To: | "Hayato Kuroda (Fujitsu)" <kuroda(dot)hayato(at)fujitsu(dot)com> |
Cc: | Ashutosh Bapat <ashutosh(dot)bapat(dot)oss(at)gmail(dot)com>, Peter Smith <smithpb2250(at)gmail(dot)com>, Amit Kapila <amit(dot)kapila16(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-03-10 07:04:27 |
Message-ID: | CAHv8RjL1H6EBEvWnco9kAYbbLfO+sifeaJseZqBPPkOWjZ3hJw@mail.gmail.com |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-hackers |
On Fri, Feb 28, 2025 at 6:33 PM Hayato Kuroda (Fujitsu)
<kuroda(dot)hayato(at)fujitsu(dot)com> wrote:
>
> Dear Shubham,
>
> Thanks for updating the patch.
>
> I think the modification [1] is not correct - the loop is meaningless because the same
> query would be executed every time. How about idea like attached? Here, instead of
> try escaping dbname, dbname is directly obtained from the instance and they are compared.
>
> How do you think?
>
> [1]:
> ```
> +# Verify that only user databases got subscriptions (not template databases)
> +my @user_dbs = ('postgres', $db1, $db2);
> +foreach my $dbname (@user_dbs)
> +{
> + $result = $node_s2->safe_psql('postgres',
> + "SELECT count(*) FROM pg_subscription, pg_database WHERE subdbid = pg_database.oid and datistemplate = 'f';"
> + );
> + is($result, '3', "Subscription created successfully for $dbname");
> + $result = $node_s2->safe_psql('postgres',
> + "SELECT count(*) FROM pg_subscription, pg_database WHERE subdbid = pg_database.oid and datistemplate = 't';"
> + );
> + is($result, '0', "Subscription created successfully for $dbname");
> +}
> ```
>
I agree with your suggestion and have incorporated the proposed
changes in the latest patch. Instead of escaping dbname, I now fetch
it directly from the instance for comparison, making the loop more
meaningful.
Additionally, as suggested by Ashutosh in [1], I have split the
040_pg_createsubscriber.pl file into three parts to improve clarity.
The attached patch includes all the suggested changes.
Thanks and regards,
Shubham Khanna.
From | Date | Subject | |
---|---|---|---|
Next Message | Shubham Khanna | 2025-03-10 07:06:22 | Re: Enhance 'pg_createsubscriber' to retrieve databases automatically when no database is provided. |
Previous Message | Pavel Stehule | 2025-03-10 06:58:43 | Re: SQLFunctionCache and generic plans |