On Mon, Oct 31, 2022 at 2:24 PM Dilip Kumar <dilipbalaut@gmail.com> wrote:
>
> On Sun, Oct 30, 2022 at 7:22 PM Japin Li <japinli@hotmail.com> wrote:
>
> > > I am just wondering if it is correct behavior to allow renaming the
> > > table used by a subscription, or should there be some dependency?
> >
> > Maybe we can add a dependency to make the user know what they are doing.
> > I also want to know when we should add a dependency?
>
> I haven't thought about it in deep, but I think whenever we add a new
> entry to pg_subscription_rel, that time maybe we could add a
> dependency on the respective subscription entry IMHO. But I am just
> wondering is there any reason why we are not already having such
> dependency?
>
As per our current implementation, users need to be careful with DDL
operations on tables involved in subscriptions to ensure smooth
replication. In the example shared in this thread, say if the user
wants to rename tables on both publisher and subscriber then the case
reported would have worked without hassles, and disallowing Alter
Table would have unnecessarily made that operation difficult.
Similarly, say if the user wants to add a primary key on the table on
both publisher and subscriber, then it would be quite easy with the
current system but adding dependencies could be additional work for
the user and some people can complain about the same.
--
With Regards,
Amit Kapila.