Re: Logical Replication - Should Destination Table Columns Be Defined With Default Value

From: "David G(dot) Johnston" <david(dot)g(dot)johnston(at)gmail(dot)com>
To: Avi Weinberg <AviW(at)gilat(dot)com>
Cc: "pgsql-general(at)lists(dot)postgresql(dot)org" <pgsql-general(at)lists(dot)postgresql(dot)org>
Subject: Re: Logical Replication - Should Destination Table Columns Be Defined With Default Value
Date: 2021-11-09 15:54:41
Message-ID: CAKFQuwaTLveZQjeo+yPMkWBM=J_2rW5Z120ZdMGHiCVW=bUW0g@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

On Tue, Nov 9, 2021 at 7:50 AM Avi Weinberg <AviW(at)gilat(dot)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.

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Avi Weinberg 2021-11-09 16:02:02 RE: Logical Replication - Should Destination Table Columns Be Defined With Default Value
Previous Message Avi Weinberg 2021-11-09 14:50:45 Logical Replication - Should Destination Table Columns Be Defined With Default Value