RE: Support logical replication of DDLs

From: "houzj(dot)fnst(at)fujitsu(dot)com" <houzj(dot)fnst(at)fujitsu(dot)com>
To: Ajin Cherian <itsajin(at)gmail(dot)com>, vignesh C <vignesh21(at)gmail(dot)com>
Cc: Peter Smith <smithpb2250(at)gmail(dot)com>, Zheng Li <zhengli10(at)gmail(dot)com>, li jie <ggysxcq(at)gmail(dot)com>, Dilip Kumar <dilipbalaut(at)gmail(dot)com>, Alvaro Herrera <alvherre(at)alvh(dot)no-ip(dot)org>, Amit Kapila <amit(dot)kapila16(at)gmail(dot)com>, Masahiko Sawada <sawada(dot)mshk(at)gmail(dot)com>, Japin Li <japinli(at)hotmail(dot)com>, rajesh singarapu <rajesh(dot)rs0541(at)gmail(dot)com>, PostgreSQL Hackers <pgsql-hackers(at)lists(dot)postgresql(dot)org>
Subject: RE: Support logical replication of DDLs
Date: 2023-02-28 04:24:30
Message-ID: OS0PR01MB57160412FC99012E54735E9194AC9@OS0PR01MB5716.jpnprd01.prod.outlook.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general pgsql-hackers

On Thursday, February 23, 2023 7:42 PM Ajin Cherian <itsajin(at)gmail(dot)com> wrote:
>
> On Tue, Feb 7, 2023 at 11:05 PM vignesh C <vignesh21(at)gmail(dot)com> wrote:
> >
> > On Mon, 6 Feb 2023 at 17:02, vignesh C <vignesh21(at)gmail(dot)com> wrote:
> > >
> > I found few issues while testing:
> > Issue 7: no owned sequence found
> > Steps to reproduce:
> > CREATE TABLE itest13 (a int);
> > ALTER TABLE itest13 ADD COLUMN b int GENERATED BY DEFAULT AS
> IDENTITY;
> >
>
> I've fixed this issue. The reason for the failure was because, for implicitly
> generated sequences, the sequence relation is stored in
> coldef->identitysequence and has to be fetched from there.
> The fix is in patch-0002

In the past patch set, we introduced a new SCT_xx command some new functions to
collect CREATE/ALTER PUBLICATION command. After rethinking, we can try to use
the existing collected parse tree and objectaddress to deparse the publication
commands instead. And here is the new version patch which attempts to do it this
way.

For CREATE PUBLICATION command, we can get all the table and schema information
from pg_publication_rel/namespace catalog and build the command. For ALTER
PUBLICATION ADD/DROP/SET command, because we collect each added and dropped
object separately, so we need to convert the original command to serval single
ADD or DROP commands like the following:

--
ALTER PUBLICATION pub1 ADD table t1, t2, t3;

will be converted to:

ALTER PUBLICATION pub1 ADD table t1;
ALTER PUBLICATION pub1 ADD table t2;
ALTER PUBLICATION pub1 ADD table t3;
--

0003,0006 and 0008 patch are modified in this version.

Best regards,
Hou zj

Attachment Content-Type Size
v74-0008-Allow-replicated-objects-to-have-the-same-owner-.patch application/octet-stream 59.2 KB
v74-0001-Infrastructure-to-support-DDL-deparsing.patch application/octet-stream 44.3 KB
v74-0002-Functions-to-deparse-Table-DDL-commands.patch application/octet-stream 131.4 KB
v74-0003-Support-DDL-deparse-of-the-rest-commands.patch application/octet-stream 204.8 KB
v74-0004-Introduce-the-test_ddl_deparse_regress-test-modu.patch application/octet-stream 47.3 KB
v74-0005-DDL-messaging-infrastructure-for-DDL-replication.patch application/octet-stream 41.5 KB
v74-0006-Support-DDL-replication.patch application/octet-stream 207.4 KB
v74-0007-Document-DDL-replication-and-DDL-deparser.patch application/octet-stream 40.6 KB

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Alban Hertroys 2023-02-28 08:10:54 Re: DISTINCT *and* ORDER BY in aggregate functions on expressions(!)y
Previous Message Thorsten Glaser 2023-02-28 02:54:58 Re: DISTINCT *and* ORDER BY in aggregate functions on expressions(!)y

Browse pgsql-hackers by date

  From Date Subject
Next Message Michael Paquier 2023-02-28 04:45:41 Re: We shouldn't signal process groups with SIGQUIT
Previous Message Takamichi Osumi (Fujitsu) 2023-02-28 03:31:06 RE: Rework LogicalOutputPluginWriterUpdateProgress