Re: Fix uninitialized copy_data var (src/backend/commands/subscriptioncmds.c)

From: Ranier Vilela <ranier(dot)vf(at)gmail(dot)com>
To: Pg Hackers <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: Fix uninitialized copy_data var (src/backend/commands/subscriptioncmds.c)
Date: 2021-06-25 13:55:21
Message-ID: CAEudQAp8PUP69LJ-8icMHvWQWzB0=+fPQPx26PDqm-cKrrUg=w@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Em qua., 23 de jun. de 2021 às 14:38, Ranier Vilela <ranier(dot)vf(at)gmail(dot)com>
escreveu:

> Hi,
>
> Not per Coverity!
>
> About comments:
> 1. For drop, no "copy data"
> 2. Only refresh the added/*dropped* list of publications. (my emphasis)
>
> The documentation says:
> https://www.postgresql.org/docs/14/sql-altersubscription.html
>
> "DROP PUBLICATION *publication_name*
>
> Changes the list of subscribed publications. SET replaces the entire list
> of publications with a new list, ADD adds additional publications, DROP
> removes publications from the list of publications. See CREATE
> SUBSCRIPTION
> <https://www.postgresql.org/docs/14/sql-createsubscription.html> for more
> information. By default, this command will also act like REFRESH
> PUBLICATION, except that in case of ADD or DROP, only the added or
> dropped publications are refreshed.
>
> *set_publication_option* specifies additional options for this operation.
> The supported options are:
> refresh (boolean)
>
> When false, the command will not try to refresh table information. REFRESH
> PUBLICATION should then be executed separately. The default is true.
>
> Additionally, refresh options as described under REFRESH PUBLICATION may
> be specified."
> So, is allowed DROP PUBLICATION with (refresh = true)
>
> I try some tests with subscription.sql:
> CREATE SUBSCRIPTION regress_testsub3 CONNECTION
> 'dbname=regress_doesnotexist' PUBLICATION testpub WITH (connect = false,
> streaming = true);
> +CREATE SUBSCRIPTION regress_testsub3 CONNECTION
> 'dbname=regress_doesnotexist' PUBLICATION testpub WITH (connect = false,
> streaming = true);
> +WARNING: tables were not subscribed, you will have to run ALTER
> SUBSCRIPTION ... REFRESH PUBLICATION to subscribe the tables
>
> ALTER SUBSCRIPTION regress_testsub3 ENABLE;
> ALTER SUBSCRIPTION regress_testsub3 REFRESH PUBLICATION;
> +ALTER SUBSCRIPTION regress_testsub3 ENABLE;
> +ALTER SUBSCRIPTION regress_testsub3 REFRESH PUBLICATION;
> +ERROR: could not connect to the publisher: connection to server at
> "localhost" (::1), port 58080 failed: FATAL: database
> "regress_doesnotexist" does not exist
>
> -- ok - delete active publication with refresh = true
> ALTER SUBSCRIPTION regress_testsub3 DROP PUBLICATION testpub WITH (refresh
> = true);
> +-- ok - delete active publication with refresh = true
> +ALTER SUBSCRIPTION regress_testsub3 DROP PUBLICATION testpub WITH
> (refresh = true);
> +ERROR: subscription must contain at least one publication
>
> I think this bug is live, for lack of tests with DROP PUBLICATION WITH
> (refresh = true).
>
https://github.com/postgres/postgres/commit/3af10943ce21450e299b3915b9cad47cd90369e9
fixes some issues with subscriptioncmds.c, but IMHO still lack this issue.

regards,
Ranier Vilela

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Tom Lane 2021-06-25 14:46:57 Re: subscription/t/010_truncate.pl failure on desmoxytes in REL_13_STABLE
Previous Message Andrew Dunstan 2021-06-25 13:37:50 Re: Some incorrect logs in TAP tests of pgbench