Re: Logical Replication of Multiple Schema Versions

From: Dan shmidt <dshmidt(at)hotmail(dot)com>
To: Peter Eisentraut <peter(dot)eisentraut(at)2ndquadrant(dot)com>, "pgsql-general(at)lists(dot)postgresql(dot)org" <pgsql-general(at)lists(dot)postgresql(dot)org>
Subject: Re: Logical Replication of Multiple Schema Versions
Date: 2019-12-11 21:17:19
Message-ID: MN2PR02MB64475930199AF6D09DE2E3FEA45A0@MN2PR02MB6447.namprd02.prod.outlook.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

Thanks Peter for your answer.

I was hoping to keep the freedom of performing any change to my schema.
Since the entire upgrade might take more than a week, there will be a time in which I have two publisher nodes with different schema versions (which might include a column rename).
I was hoping that were was a way to somehow apply some logic on the subscriber to convert one schema to another. I also believe that limiting schema changes only to those that won't break replication should suffice.

Dan.

________________________________
From: Peter Eisentraut <peter(dot)eisentraut(at)2ndquadrant(dot)com>
Sent: Wednesday, December 11, 2019 6:13 PM
To: Dan shmidt <dshmidt(at)hotmail(dot)com>; pgsql-general(at)lists(dot)postgresql(dot)org <pgsql-general(at)lists(dot)postgresql(dot)org>
Subject: Re: Logical Replication of Multiple Schema Versions

On 2019-12-10 08:55, Dan shmidt wrote:
> What is the correct way to perform such an operation?
> Is there a way to keep constraint #1 or the only option is to not allow
> "breaking" schema changes between versions.

It all depends on the specific schema changes you want to make. You can
add columns on the subscriber and remove columns on the publisher
without breaking things (unless there are not-null constraints).
Renaming columns will break replication until you rename them
everywhere. Column type changes will usually just work as long as the
data fits into both the old and the new type.

You really need to carefully plan and test each class of scenarios
separately.

--
Peter Eisentraut http://www.2ndQuadrant.com/
PostgreSQL Development, 24x7 Support, Remote DBA, Training & Services

Browse pgsql-general by date

  From Date Subject
Next Message Mike Lissner 2019-12-12 00:37:49 Logical replication DNS cache
Previous Message Rich Shepard 2019-12-11 21:11:05 Re: Counting number of sites with same number of sampling dates