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

2021-11-09 Thread Mark Dilger
> On Nov 9, 2021, at 1:24 PM, Michael Lewis wrote: > > Is there any advantage to not defining the default on the replica? If it is > not a static value and the publishing database will trigger row updates, I > could see waiting to set the default until after the table re-write is done, > bu

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

2021-11-09 Thread Michael Lewis
Is there any advantage to not defining the default on the replica? If it is not a static value and the publishing database will trigger row updates, I could see waiting to set the default until after the table re-write is done, but otherwise there doesn't seem to be any benefit to skipping column d

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

2021-11-09 Thread Mark Dilger
> On Nov 9, 2021, at 8:02 AM, Avi Weinberg wrote: > > • A third column is added to table with default value on publisher > side, but without default value on subscriber side > • The default value column has value for existing rows on publisher, > but null on the subscriber side.

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

2021-11-09 Thread Tom Lane
"David G. Johnston" writes: > On Tue, Nov 9, 2021 at 7:50 AM Avi Weinberg 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? > If you run a command

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

2021-11-09 Thread Avi Weinberg
- Should Destination Table Columns Be Defined With Default Value On Tue, Nov 9, 2021 at 7:50 AM Avi Weinberg mailto:a...@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 defi

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

2021-11-09 Thread David G. Johnston
On Tue, Nov 9, 2021 at 7:50 AM Avi Weinberg 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 synchroniz

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

2021-11-09 Thread Avi Weinberg
Hi Experts, I'm using logical replication and have the following open issue: If the table on the publisher side has column with default value, should the table on the destination (subscriber) be defined with default value as well? My intuition was not to define it with default value since it get