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

From Mark Dilger
Subject Re: Logical Replication - Should Destination Table Columns Be Defined With Default Value
Date
Msg-id 44A86F39-CFE9-4BEA-834A-B4AC03C827DD@enterprisedb.com
Whole thread Raw
In response to RE: 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  (Michael Lewis <mlewis@entrata.com>)
List pgsql-general

> On Nov 9, 2021, at 8:02 AM, Avi Weinberg <AviW@gilat.com> 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.

See https://www.postgresql.org/docs/14/ddl-alter.html#DDL-ALTER-ADDING-A-COLUMN

The important part is this TIP:

From PostgreSQL 11, adding a column with a constant default value no longer means that each row of the table needs to
beupdated when the ALTER TABLE statement is executed. Instead, the default value will be returned the next time the row
isaccessed, and applied when the table is rewritten, making the ALTER TABLE very fast even on large tables. 

—
Mark Dilger
EnterpriseDB: http://www.enterprisedb.com
The Enterprise PostgreSQL Company






pgsql-general by date:

Previous
From: Tom Lane
Date:
Subject: Re: Logical Replication - Should Destination Table Columns Be Defined With Default Value
Next
From: Michael Lewis
Date:
Subject: Re: Logical Replication - Should Destination Table Columns Be Defined With Default Value