public inbox for [email protected]  
help / color / mirror / Atom feed
From: Wei Wang (Fujitsu) <[email protected]>
To: vignesh C <[email protected]>
Cc: shveta malik <[email protected]>
Cc: Amit Kapila <[email protected]>
Cc: Zhijie Hou (Fujitsu) <[email protected]>
Cc: Ajin Cherian <[email protected]>
Cc: Runqi Tian <[email protected]>
Cc: Peter Smith <[email protected]>
Cc: Tom Lane <[email protected]>
Cc: li jie <[email protected]>
Cc: Dilip Kumar <[email protected]>
Cc: Alvaro Herrera <[email protected]>
Cc: Masahiko Sawada <[email protected]>
Cc: Japin Li <[email protected]>
Cc: rajesh singarapu <[email protected]>
Cc: PostgreSQL Hackers <[email protected]>
Cc: Zheng Li <[email protected]>
Subject: RE: Support logical replication of DDLs
Date: Tue, 6 Jun 2023 06:01:33 +0000
Message-ID: <OS3PR01MB62750D43D4F7F075B33BD2609E52A@OS3PR01MB6275.jpnprd01.prod.outlook.com> (raw)
In-Reply-To: <CALDaNm1oeS6NTLHFj1XWA-2d-nSZCfxUQq9ETL0CD9q5z8d00g@mail.gmail.com>
References: <CAJpy0uBktY2benA4bgresKdskgM8=Hy+aP=cJ9MAVotU9HfRFA@mail.gmail.com>
	<CALDaNm0TXZ7VfN5gfKk55CVqyuDW75NTQPtPa3X9MY8zP76g2Q@mail.gmail.com>
	<OS3PR01MB62759B11987423AB028508B89E489@OS3PR01MB6275.jpnprd01.prod.outlook.com>
	<CALDaNm1oeS6NTLHFj1XWA-2d-nSZCfxUQq9ETL0CD9q5z8d00g@mail.gmail.com>

On Thur, June 1, 2023 at 23:42 vignesh C <[email protected]> wrote:
> On Wed, 31 May 2023 at 14:32, Wei Wang (Fujitsu) <[email protected]>
> 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


Attachments:

  [application/octet-stream] tmp_fix.patch.bak (935B, ../OS3PR01MB62750D43D4F7F075B33BD2609E52A@OS3PR01MB6275.jpnprd01.prod.outlook.com/2-tmp_fix.patch.bak)
  download

view thread (5+ messages)  latest in thread

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients using the --to and --cc options:
  reply via email

  To: [email protected]
  Cc: [email protected], [email protected], [email protected], [email protected], [email protected], [email protected], [email protected], [email protected], [email protected], [email protected], [email protected], [email protected], [email protected], [email protected], [email protected], [email protected], [email protected]
  Subject: RE: Support logical replication of DDLs
  In-Reply-To: <OS3PR01MB62750D43D4F7F075B33BD2609E52A@OS3PR01MB6275.jpnprd01.prod.outlook.com>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by agora; see mirroring instructions
for how to clone and mirror all data and code used for this inbox