From: | Mark Dilger <mark(dot)dilger(at)enterprisedb(dot)com> |
---|---|
To: | Avi Weinberg <AviW(at)gilat(dot)com> |
Cc: | "David G(dot) Johnston" <david(dot)g(dot)johnston(at)gmail(dot)com>, "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 16:07:47 |
Message-ID: | 44A86F39-CFE9-4BEA-834A-B4AC03C827DD@enterprisedb.com |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-general |
> On Nov 9, 2021, at 8:02 AM, Avi Weinberg <AviW(at)gilat(dot)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 be updated when the ALTER TABLE statement is executed. Instead, the default value will be returned the next time the row is accessed, 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
From | Date | Subject | |
---|---|---|---|
Next Message | Michael Lewis | 2021-11-09 21:24:00 | Re: Logical Replication - Should Destination Table Columns Be Defined With Default Value |
Previous Message | Tom Lane | 2021-11-09 16:06:22 | Re: Logical Replication - Should Destination Table Columns Be Defined With Default Value |