Re: Support logical replication of DDLs

From: shveta malik <shveta(dot)malik(at)gmail(dot)com>
To: "Wei Wang (Fujitsu)" <wangw(dot)fnst(at)fujitsu(dot)com>
Cc: vignesh C <vignesh21(at)gmail(dot)com>, Amit Kapila <amit(dot)kapila16(at)gmail(dot)com>, "Zhijie Hou (Fujitsu)" <houzj(dot)fnst(at)fujitsu(dot)com>, Ajin Cherian <itsajin(at)gmail(dot)com>, Runqi Tian <runqidev(at)gmail(dot)com>, Peter Smith <smithpb2250(at)gmail(dot)com>, Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>, li jie <ggysxcq(at)gmail(dot)com>, Dilip Kumar <dilipbalaut(at)gmail(dot)com>, Alvaro Herrera <alvherre(at)alvh(dot)no-ip(dot)org>, 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>, Zheng Li <zhengli10(at)gmail(dot)com>, shveta malik <shveta(dot)malik(at)gmail(dot)com>
Subject: Re: Support logical replication of DDLs
Date: 2023-06-08 12:18:14
Message-ID: CAJpy0uCG_7d7Mk6oUWbx8zHJX43B=S0ztxz8=YnOZGgfubwcPw@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general pgsql-hackers

On Tue, Jun 6, 2023 at 11:31 AM Wei Wang (Fujitsu)
<wangw(dot)fnst(at)fujitsu(dot)com> wrote:
>
> On Thur, June 1, 2023 at 23:42 vignesh C <vignesh21(at)gmail(dot)com> wrote:
> > On Wed, 31 May 2023 at 14:32, Wei Wang (Fujitsu) <wangw(dot)fnst(at)fujitsu(dot)com>
> > wrote:
> > > ~~~
> > >
> > > 2. Deparsed results of the partition table.
> > > When I run the following SQLs:
> > > ```
> > > create table parent (a int primary key) partition by range (a);
> > > create table child partition of parent default;
> > > ```
> > >
> > > I got the following two deparsed results:
> > > ```
> > > CREATE TABLE public.parent (a pg_catalog.int4 STORAGE PLAIN ,
> > CONSTRAINT parent_pkey PRIMARY KEY (a)) PARTITION BY RANGE (a)
> > > CREATE TABLE public.child PARTITION OF public.parent (CONSTRAINT
> > child_pkey PRIMARY KEY (a)) DEFAULT
> > > ```
> > >
> > > When I run these two deparsed results on another instance, I got the following
> > error:
> > > ```
> > > postgres=# CREATE TABLE public.parent (a pg_catalog.int4 STORAGE PLAIN ,
> > CONSTRAINT parent_pkey PRIMARY KEY (a)) PARTITION BY RANGE (a);
> > > CREATE TABLE
> > > postgres=# CREATE TABLE public.child PARTITION OF public.parent
> > (CONSTRAINT child_pkey PRIMARY KEY (a)) DEFAULT;
> > > ERROR: multiple primary keys for table "child" are not allowed
> > > ```
> > >
> > > I think that we could skip deparsing the primary key related constraint for
> > > partition (child) table in the function obtainConstraints for this case.
> >
> > Not applicable for 0008 patch
>
> I think this issue still exists after applying the 0008 patch. Is this error the
> result we expected?
> If no, I think we could try to address this issue in the function
> deparse_Constraints_ToJsonb in 0008 patch like the attachment. What do you
> think? BTW, we also need to skip the parentheses in the above case if you think
> this approach is OK.
>

Thank You Wang-san for the patch, we have included the fix after
slight modification in the latest patch-set (*2023_06_08.patch).

thanks
Shveta

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Masahiko Sawada 2023-06-09 00:05:08 Re: Support logical replication of DDLs
Previous Message shveta malik 2023-06-08 12:07:58 Re: Support logical replication of DDLs

Browse pgsql-hackers by date

  From Date Subject
Next Message Jan Wieck 2023-06-08 12:43:35 Re: Named Prepared statement problems and possible solutions
Previous Message Matthias van de Meent 2023-06-08 12:15:33 Re: Let's make PostgreSQL multi-threaded