Re: Logical replication disabled, recovery not possible because of 1 large transaction with schema changes? - Mailing list pgsql-general

From Michał Kłeczek
Subject Re: Logical replication disabled, recovery not possible because of 1 large transaction with schema changes?
Date
Msg-id 657111A5-7475-4198-B8FD-83E87D628F5B@kleczek.org
Whole thread Raw
In response to Re: Logical replication disabled, recovery not possible because of 1 large transaction with schema changes?  (Koen De Groote <kdg.dev@gmail.com>)
Responses Re: Logical replication disabled, recovery not possible because of 1 large transaction with schema changes?
List pgsql-general

> On 17 Oct 2024, at 11:07, Koen De Groote <kdg.dev@gmail.com> wrote:
>
> Hello Muhammad,
>
> The problem with my scenario is the changes are written as a single transaction, with a BEGIN and COMMIT. In that
transaction,there are first inserts, then a schema change, and then inserts on the new schema. 

I guess until logical replication of DDL is available you’re out of luck.

The best you can do is to have a separate table for recording and replaying schema changes.
Create triggers that perform actual DDL operations based on DML in this table.
Publish this table on the publisher in the same publication as the tables affected by the DDL.

On the subscriber side it is the same - just make the trigger is marked as ENABLE REPLICA TRIGGER or ENABLE ALWAYS
TRIGGER.

Kind regards,
Michał




pgsql-general by date:

Previous
From: Koen De Groote
Date:
Subject: Re: Logical replication disabled, recovery not possible because of 1 large transaction with schema changes?
Next
From: Koen De Groote
Date:
Subject: Re: Logical replication disabled, recovery not possible because of 1 large transaction with schema changes?