Re: Logical Replication - Should Destination Table Columns Be Defined With Default Value - Mailing list pgsql-general

From David G. Johnston
Subject Re: Logical Replication - Should Destination Table Columns Be Defined With Default Value
Date
Msg-id CAKFQuwaTLveZQjeo+yPMkWBM=J_2rW5Z120ZdMGHiCVW=bUW0g@mail.gmail.com
Whole thread Raw
In response to Logical Replication - Should Destination Table Columns Be Defined With Default Value  (Avi Weinberg <AviW@gilat.com>)
Responses RE: Logical Replication - Should Destination Table Columns Be Defined With Default Value  (Avi Weinberg <AviW@gilat.com>)
Re: Logical Replication - Should Destination Table Columns Be Defined With Default Value  (Tom Lane <tgl@sss.pgh.pa.us>)
List pgsql-general
On Tue, Nov 9, 2021 at 7:50 AM Avi Weinberg <AviW@gilat.com> wrote:

Was this done on purpose, that default value for new column is not copied for existing data?  Does this mean that on destination side we must also define the table with default value? 


Logical replication has two modes, initial synchronization and ongoing change push.  The ongoing change push sends entire rows, when they change, from the publisher to subscriber.

The initial sync happens once, when the subscriber initially subscribes to the publication.

As entire rows are getting sent, defaults on the subscriber are immaterial so far as the published rows are concerned.

If you run a command on the publisher that causes every row to change then of course every row will be published with those new values to the subscriber.

David J.

pgsql-general by date:

Previous
From: Avi Weinberg
Date:
Subject: Logical Replication - Should Destination Table Columns Be Defined With Default Value
Next
From: Avi Weinberg
Date:
Subject: RE: Logical Replication - Should Destination Table Columns Be Defined With Default Value