RE: Support logical replication of DDLs

From: "Wei Wang (Fujitsu)" <wangw(dot)fnst(at)fujitsu(dot)com>
To: vignesh C <vignesh21(at)gmail(dot)com>
Cc: shveta malik <shveta(dot)malik(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>
Subject: RE: Support logical replication of DDLs
Date: 2023-06-06 06:01:33
Message-ID: OS3PR01MB62750D43D4F7F075B33BD2609E52A@OS3PR01MB6275.jpnprd01.prod.outlook.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general pgsql-hackers

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.

Regards,
Wang wei

Attachment Content-Type Size
tmp_fix.patch.bak application/octet-stream 935 bytes

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Hrishikesh (Richie) Rode 2023-06-06 07:18:01 Drivers users by connections
Previous Message Ron 2023-06-05 19:43:57 Re: Composite type: Primary Key and validation

Browse pgsql-hackers by date

  From Date Subject
Next Message Kyotaro Horiguchi 2023-06-06 06:13:14 Re: 回复:Fix missing initialization of delayChkptEnd
Previous Message John Naylor 2023-06-06 05:13:36 Re: [PoC] Improve dead tuple storage for lazy vacuum